Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Bird(object):
- MOVES = 'moving'
- def __init__(self, name):
- self.name = name
- def moveTo(self, destination):
- print self.name, 'is', self.MOVES, 'to', destination
- class FlyBird(Bird):
- MOVES = 'flying'
- class Parrot(FlyBird):
- def __init__(self, name, says):
- FlyBird.__init__(self, name)
- self.whatToSay = says
- def speak(self):
- print self.whatToSay
- class Ostrich(Bird):
- MOVES = 'runing like only ostrichs do'
- polly = Parrot('Polly', 'Polly want cookie!')
- polly.moveTo('Costa Rica')
- polly.speak()
- bruno = Ostrich('Buno')
- bruno.moveTo('his nest')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement