Skip to content

Instantly share code, notes, and snippets.

@zeldani
Created February 27, 2014 18:56
Show Gist options
  • Save zeldani/9256627 to your computer and use it in GitHub Desktop.
Save zeldani/9256627 to your computer and use it in GitHub Desktop.
class Animal:
def __init__(self, nome):
self.nome = nome
class Gato(Animal):
def fala(self):
return 'Miau!'
class Cachorro(Animal):
def fala(self):
return 'Au! Au!'
animais = [Gato('Kitty'),
Cachorro('Tibby')]
for animal in animais:
print animal.nome + ': ' + animal.fala()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment