Skip to content

Instantly share code, notes, and snippets.

@marcoscastro
Created January 24, 2018 05:45
Show Gist options
  • Save marcoscastro/2fa4075ae1390bb2b703157e383a5ce8 to your computer and use it in GitHub Desktop.
Save marcoscastro/2fa4075ae1390bb2b703157e383a5ce8 to your computer and use it in GitHub Desktop.
Curso Python 300 - Aula 38 - Herança Implementação
class Pessoa:
def __init__(self, nome, idade):
self.nome = nome
self.idade = idade
def mostrar_nome(self):
print(self.nome)
def mostrar_idade(self):
print(self.idade)
class Estudante(Pessoa):
def __init__(self, nome, idade, mat):
Pessoa.__init__(self, nome, idade)
self.mat = mat
def mostrar_mat(self):
print(self.mat)
p = Pessoa("marcos", 30)
p.mostrar_idade()
s = Estudante("pedro", 20, 1000)
s.mostrar_nome()
s.mostrar_mat()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment