Zadanie z kodem · Kurs Python · Moduł 3: Programowanie obiektowe

Projekt - Enkapsulacja

Dodaj enkapsulację do klas

Zadanie

W klasie Animal(name, age, health_status) zapisz age i health_status w atrybutach chronionych lub prywatnych (self._age albo self.__age) i dodaj dla nich property age i health_status