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..fb57f8d42 --- /dev/null +++ b/oo/pessoa.py @@ -0,0 +1,20 @@ +class Pessoa: + def __init__(self, *filhos, nome=None, idade=32): + self.idade = idade + self.nome = nome + self.filhos = list(filhos) + + def cumprimentar(self): + return f'Olá!{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) + print(luciano.idade) + for filho in luciano.filhos: + print(filho.nome)