Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Animal(object):
- '''
- Our animal object
- '''
- def __init__(self,name,animalType):
- print "My name is ",name
- print "I am a ",animalType
- def testM__private(self):
- print 'blaat'
- def makeNoise(self,noise):
- print noise
- def sleep(self):
- print "zzzzZZZZzzzzZZZ"
- def eat(self,food):
- print "Eating ",food
- class Tiger(Animal):
- def __init__(self,name):
- super(Tiger,self).__init__(name,"Tiger")
- self.makeNoise("roar")
- def stalk(self):
- print "Stalking an antilope"
- self.eat("antilope meat")
- tony = Tiger("Tony")
- tony.stalk()
- tony.sleep()
- class Peacock(Animal):
- def __init__(self,name):
- super(Peacock,self).__init__(name,"Peacock")
- self.makeNoise('CRIOOOUUUUUULLLL')
- def showTailFeathers(self):
- print "Look at them feathers"
- def eat(self):
- super(Peacock,self).eat("Wheat")
- print "burp"
- class Fly(object):
- def __init__(self):
- print "I have the ability to fly!"
- def fly(self):
- print "Im flying wiieeeeee"
- class Swim(object):
- def __init__(self):
- print "I have the ability to swim!"
- def swim(self):
- print "Im swimming like a boss"
- class Duck(Animal,Fly,Swim):
- def __init__(self,name):
- super(Duck,self).__init__(name,"Duck")
- Swim.__init__(self)
- Fly.__init__(self)
- class WalkOnLand(object):
- def __init__(self):
- print 'I can walk on land'
- def walk(self):
- print "walking... and I hope you like walking too"
- class Amphibian(Animal,Swim,WalkOnLand):
- def __init__(self,name,typeA):
- print "Im an amphibian,"
- super(Amphibian,self).__init__(name,typeA)
- Swim.__init__(self)
- WalkOnLand.__init__(self)
- class Frog(Amphibian):
- def __init__(self,name):
- super(Frog,self).__init__(name,"Frog")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement