#!/usr/bin/env python # Author:liujun class People(object): def __init__(self,name,age): self.name = name self.age = age def eat(self): print("%s is eating ...."% self.name) def talk(self): print("%s is sleeping ..."% self.name) def sleep(self): print("%s is sleeping...."%self.name) class Relation(object): def makeFriends(self,obj): print("%s is making friends with %s"%(self.name,obj.name)) class Man(People,Relation): def __init__(self,name,age,money): # Overwrite the constructor #Version 1 #People.__init__(self,name,age) #Version 2 super(Man,self).__init__(name,age) self.money = money print("You have %d money when you are borned..."% self.money) def piao(self): # This is a new method in Man print("%s is piao .... 20s .... done"% self.name) def sleep(self): # overwrite the method in sleep People.sleep(self) print("man is sleeping......") class Woman(People,Relation): def getBirth(self): print("%s is born a baby......"% self.name) m1 = Man("Liujun",28,100) w1 = Woman("ChenRongHua",26) m1.makeFriends(w1)