Created
October 2, 2013 13:23
-
-
Save fmobus/6793678 to your computer and use it in GitHub Desktop.
This file contains 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 vocalize(self): | |
print 'my vocalization' | |
class Cat(Animal): | |
def vocalize(self): | |
print 'meow' | |
class Dog(Animal): | |
def vocalize(self): | |
print 'woof woof' | |
zoo = [ Cat(), Dog(), Dog(), Cat(), Animal() ] | |
for animal in zoo: | |
animal.vocalize() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment