In [1]:
class Pessoa:
def __init__(self, nome, email, telefone):
self.nome = nome
self.email = email
self.telefone = telefone
def __repr__(self):
return '<Pessoa {0}>'.format(self.nome)
In [2]:
p = Pessoa('Fulano de Tal', 'fulano@fulano.com', '1111-1111')
print(p)
In [11]:
class Aluno(Pessoa):
def __init__(self, nome, email, tel, matricula):
super(Aluno, self).__init__(nome, email, tel)
self.matricula = matricula
def __repr__(self):
return '<Aluno {0} - Matrícula: {1}>'.format(self.nome, self.matricula)
a = Aluno('Fulano de Tal', 'fulano@fulano.com', '1111-1111', '1234')
In [12]:
print(a)
In [ ]: