Пример #1
0
from animal import Dog, Cat

kiki = Dog (name='kiki',age=3)
mimi=  Cat(name='mimi',age=5)

print(kiki.speak())
print(mimi.speak())
Пример #2
0
from animal import Dog, Cat

Luna = Dog(name='Luna', age=3)
Loly = Cat(name='Loly', age=5)

print(Luna.speak())
print(Loly.speak())
Пример #3
0
from animal import Cat, Dog

fufu = Dog(name='fufu', age=3)
bailey = Cat(name='bailey', age=7)

print(fufu.speak())
print(bailey.speak())

# Dog and Cat have inherited 'speak' from Class Animal