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.

Revisions

  1. marcoscastro created this gist Jan 24, 2018.
    28 changes: 28 additions & 0 deletions aula38.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    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()