wallacemaxters

herança de classe - teste

Apr 28th, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. class Pai(object):
  2.     __nome = ''
  3.     def adicionarNome(self, nome):
  4.         self.__nome = nome
  5.        
  6.     def obterNome(self):
  7.         return self.__nome
  8.  
  9. class Filho(Pai):
  10.     def __init__(self, nome):
  11.         super().adicionarNome(nome)
  12.     def __str__(self):
  13.         return super().obterNome() + ' Filho'
Advertisement
Add Comment
Please, Sign In to add comment