class Character(object):
def __init__(self):
self.age = 100
def printAge(self):
print self.age
class Human(Character):
def __init__(self, name, petname):
super(Human,self).__init__()
self.name = name
self.pet = Pet(petname)
def __str__(self):
return 'my name is '+self.name
class Pet:
def __init__(self,name):
self.name = name
def __str__(self):
return 'i am a pet, and my name is '+self.name
jack = Human('jack','jenny')
jack.printAge()
print jack
print jack.pet
print dir(jack.pet)