Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit ca808c7

Browse files
committed
atualização função super()
1 parent a6b82e0 commit ca808c7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

oo/pessoa.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ def __init__(self, *filhos, nome = None, idade=35):
77
self.filhos = list(filhos)
88

99
def cumprimentar(self):
10-
return "Olá"
10+
return f"Olá, meu nome é {self.nome}"
1111

1212
class Homem(Pessoa):
13-
pass
13+
def cumprimentar(self):
14+
cumprimentar_classe = super().cumprimentar()
15+
return f"{cumprimentar_classe}. Aperto de mão."
1416

1517
class Mutante(Pessoa):
1618
olhos = 4
@@ -36,4 +38,7 @@ class Mutante(Pessoa):
3638
print(Pessoa.olhos)
3739
print(julio.olhos)
3840
print(lucas.olhos)
41+
print(julio.cumprimentar())
42+
print(lucas.cumprimentar())
43+
3944

0 commit comments

Comments
 (0)