23 lines
386 B
Python
23 lines
386 B
Python
from abc import ABC, abstractmethod
|
|
|
|
|
|
class Animal(ABC):
|
|
@abstractmethod
|
|
def move(self):
|
|
pass
|
|
|
|
|
|
class Cat(Animal):
|
|
def move(self):
|
|
print("No. Cat doesn't want to move his furry arse")
|
|
|
|
|
|
class Dog(Animal):
|
|
def move(self) -> None:
|
|
print("Dog's running towards you")
|
|
|
|
|
|
animals: list[Animal] = [Cat(), Dog()]
|
|
for animal in animals:
|
|
animal.move()
|