print example polymorphism
This commit is contained in:
parent
5bc969328c
commit
63912afe09
9
python-temel/print.example.py
Normal file
9
python-temel/print.example.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user