print example polymorphism

This commit is contained in:
Mert Gör 🇹🇷 2023-07-15 14:46:35 +03:00
parent 5bc969328c
commit 63912afe09
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9

View File

@ -0,0 +1,9 @@
class Sample:
def __init__(self, val):
self.val = val
def __str__(self):
return 'Sample object, value = {}'.format(self.val)
s = Sample(100)
print(s)