Created
February 27, 2014 18:56
-
-
Save zeldani/9256627 to your computer and use it in GitHub Desktop.
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 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