Untitled
unknown
plain_text
2 years ago
1.4 kB
2
Indexable
Never
from abc import ABC, abstractmethod class Pasari(ABC): def __init__(self, greutate, specie, viteza): self.greutate = greutate self.specie = specie self.viteza = viteza @abstractmethod def setViteza(self, viteza): pass def afisareDate(self): print(self.specie + " " + str(self.greutate) +" kg " + str(self.viteza) + " km/h ", end =" ") class Gaina(Pasari): def __init__(self, greutate, specie, viteza, nrOuaZi): super().__init__(greutate, specie, viteza) self.nrOuaZi = nrOuaZi def setNrOua(self, nrOuaZi): self.nrOuaZi = nrOuaZi def afisareDate(self): super().afisareDate() print(str(self.nrOuaZi) + " oua") def setViteza(self, viteza): self.viteza = viteza class Vultur(Pasari): def __init__(self, greutate, specie, viteza, varsta): super().__init__(greutate, specie, viteza) self.varsta = varsta def setVarsta(self, varsta): self.varsta = varsta def afisareDate(self): super().afisareDate() print(str(self.varsta) + "\n") def setViteza(self, viteza): self.viteza = viteza class Zoo(): def __init__(self): gaina1 = Gaina(5, "specie1", 10, 5) gaina1.setViteza(10) gaina1.afisareDate(); Zoo()