print example polymorphism 3
This commit is contained in:
parent
26386c4368
commit
a5b8fac0eb
11
python-temel/print.example.3.py
Normal file
11
python-temel/print.example.3.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class Date:
|
||||||
|
def __init__(self, day, month, year):
|
||||||
|
self.day = day
|
||||||
|
self.month = month
|
||||||
|
self.year = year
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '{}/{}/{}'.format(self.day, self.month, self.year)
|
||||||
|
|
||||||
|
d = Date(10, 12, 2008)
|
||||||
|
print(d)
|
Loading…
Reference in New Issue
Block a user