Created
January 24, 2018 05:45
-
-
Save marcoscastro/2fa4075ae1390bb2b703157e383a5ce8 to your computer and use it in GitHub Desktop.
Curso Python 300 - Aula 38 - Herança Implementação
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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