Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Teste de Gets
- '''
- class Cor():
- '''
- Uma Cor Qualquer
- '''
- def __get__(self, pai, outro):
- return pai.cor
- class Cabelo():
- '''
- Um cabelo qualquer
- '''
- coloracao = Cor()
- def __init__(self, cor, tipo):
- self.cor = cor
- self.tipo = tipo
- def __get__(self, atributo, outro):
- return getattr(self, atributo)
- def __int__(self):
- return len(self.cor)
- if __name__ == "__main__":
- X = Cabelo("escuro", "cacheado")
- print(X.coloracao)
- print(X.tipo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement