11class Pessoa :
2-
32 olhos = 2
43
54 def __init__ (self , * filhos , nome = None , idade = 35 ):
@@ -8,21 +7,29 @@ def __init__(self, *filhos, nome=None, idade=35):
87 self .filhos = list (filhos )
98
109 def cumprimentar (self ):
11- return f'Olá { id ( self ) } '
10+ return f'Olá, meu nome é { self . nome } '
1211
1312 @staticmethod
1413 def metodo_estatico ():
1514 return 42
15+
1616 @classmethod
1717 def nome_e_atributos_de_classe (cls ):
1818 return f'{ cls } - olhos { cls .olhos } '
1919
20+
2021class Homem (Pessoa ):
21- pass
22+ def cumprimentar (self ):
23+ cumprimentar_da_classe_pai = super ().cumprimentar ()
24+ return f'{ cumprimentar_da_classe_pai } . Aperto de mão'
25+
26+ class Mutante (Pessoa ):
27+ olhos = 3
28+
2229
2330if __name__ == '__main__' :
24- renzo = Homem (nome = 'Renzo' )
25- luciano = Pessoa (renzo , nome = 'Luciano' )
31+ renzo = Mutante (nome = 'Renzo' )
32+ luciano = Homem (renzo , nome = 'Luciano' )
2633 print (Pessoa .cumprimentar (luciano ))
2734 print (id (luciano ))
2835 print (luciano .cumprimentar ())
@@ -37,7 +44,7 @@ class Homem(Pessoa):
3744 del luciano .olhos
3845 print (luciano .__dict__ )
3946 print (renzo .__dict__ )
40- Pessoa . olhos = 3
47+
4148 print (Pessoa .olhos )
4249 print (luciano .olhos )
4350 print (renzo .olhos )
@@ -48,7 +55,5 @@ class Homem(Pessoa):
4855 print (isinstance (pessoa , Pessoa ))
4956 print (isinstance (pessoa , Homem ))
5057 print (isinstance (renzo , Homem ))
51-
52-
53-
54-
58+ print (luciano .cumprimentar ())
59+ print (renzo .cumprimentar ())
0 commit comments