prog-obiektowe/python/net/hypki/Main.py
2023-04-04 18:13:13 +02:00

33 lines
768 B
Python

'''
Created on Apr 4, 2023
@author: ahypki
'''
from net.hypki.Figure import Figure
from net.hypki.Square import Square
if __name__ == '__main__':
f = Figure()
f.__name = "New name"
f2 = Figure('Another name')
print(str(f))
print(str(f2))
s1 = Square('Square1')
print(str(s1))
# print(str(s1.__name)) # will not work
print(s1.get_name())
# generics... actually are not needed - duck typing
figList = [Figure('f1'), Figure('f2')]
print(figList)
print(*figList) # uses our __str__ function
figList = [Square('s1'), Square('s2')]
print(figList)
print(*figList) # uses our __str__ function
print(figList[0].get_name()) # but there is no help from IDE
print('Finished!')