diff --git a/oo/__init__.py b/oo/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/oo/pessoa.py b/oo/pessoa.py new file mode 100644 index 000000000..a0251d720 --- /dev/null +++ b/oo/pessoa.py @@ -0,0 +1,25 @@ +class Pessoa: + def __init__(self, *filhos, nome=None, idade=35): + self.nome = nome + self.idade = idade + self.filhos = list(filhos) + + def cumprimentar(self): + return f'ola {id(self)}' + +if __name__ == '__main__': + renzo = Pessoa(nome='Renzo') + luciano = Pessoa(renzo, nome='Luciano') + print(Pessoa.cumprimentar(luciano)) + print(id(luciano)) + print(luciano.cumprimentar()) + print(luciano.nome) + for filho in luciano.filhos: + print(filho.nome) + luciano.sobrenome = 'Ramalho' + del luciano.filhos + print(luciano.__dict__) + print(renzo.__dict__) + + +