initial commit
This commit is contained in:
22
Python/OOP3/task1.py
Normal file
22
Python/OOP3/task1.py
Normal file
@ -0,0 +1,22 @@
|
||||
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()
|
Reference in New Issue
Block a user