Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class zwierze:
- def __init__(self, imie,opis):
- self.imie = imie
- self.opis = opis
- @abstractmethod
- def display_info(self):
- pass
- class pies(zwierze):
- def __init__(self, rasa,waga):
- zwierze.__init__(self):
- self.rasa = rasa
- self.waga = waga
- def display_info(self):
- print(self.rasa)
- print(self.waga)
- class ptak(zwierze):
- def __init__(self, kolor, waga):
- self.kolor = kolor
- self.waga = waga
- def display_info(self):
- print(self.kolor)
- print(self.waga)
- papuga = ptak("zielony", 200)
- kanarek = ptak("Kanarek", 10)
- pies1 = pies("Dog",20)
- pies2 = pies("Jamnik", 30)
- pies1.display_info()
- pies2.display_info()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement