This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
lessons/Python/OOP3/task1.py
2023-07-16 13:23:25 +00:00

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()