In [ ]:
class Animal:
def __init__(self, name=''):
self.name = name
self.has_fleas = False
def talk(self):
pass
def play(self):
pass
class Cat(Animal):
def talk(self):
print "Meow!"
def play(self):
print "Pounce!"
class Dog(Animal):
def talk(self):
print "Woof!"
def play(self):
print "Fetch!"
c = Cat("Missy")
c.talk()
print c.has_fleas
d = Dog("Rocky")
d.talk()
d.has_fleas=True
print d.has_fleas
In [ ]: