Skip to content

Commit 23ac29c

Browse files
author
Matheus
committed
Criado atributo de classe, olhos.
1 parent 117f5d8 commit 23ac29c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

oo/pessoa.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
class Pessoa:
22

3+
olhos = 2
4+
35
def __init__(self, *filhos, nome=None, idade=35):
46
self.nome = nome
57
self.idade = idade
@@ -22,6 +24,14 @@ def cumprimentar(self):
2224
print(filho.nome)
2325
luciano.sobrenome = 'Ramalho'
2426
del luciano.filhos
27+
luciano.olhos = 1
28+
del luciano.olhos
2529
print(luciano.__dict__)
2630
print(renzo.__dict__)
31+
Pessoa.olhos = 3
32+
print(Pessoa.olhos)
33+
print(luciano.olhos)
34+
print(renzo.olhos)
35+
print(id(Pessoa.olhos), id(luciano.olhos), id(renzo.olhos))
36+
2737

0 commit comments

Comments
 (0)