pets/modelo/adocao.py

20 lines
505 B
Python

from modelo.entidade import Entidade
class Adocao(Entidade):
def __init__(self, id_, adotante):
super().__init__(id_)
self.adotante = adotante
self.itens = []
def adicionar_item(self, item):
self.itens.append(item)
def remover_item(self, item):
self.itens.remove(item)
def __str__(self):
texto = f"{super().__str__()} | Adotante: {self.adotante}\n"
for item in self.itens:
texto += f" {item}\n"
return texto