标签:ati 方法 end money tin 一个 name ini man
class people(object): #建创一个人类
def __init__(self,name,age):
self.name = name
self.age = age
def eat(self):
print("%s is eatint‘‘‘‘‘" % self.name)
def talk(self):
print("%s is talking......" % self.name)
def sleep(self):
print("%s is sleeping" % self.name)
class Relation(object): # 创建一人交朋友类
def make_friends(self,obj):
print("%s is making friends %s" %(self.name,obj.name))
class Man(people,Relation):#男人类 多继承,又继承交朋友类
def __init__(self,name,age,money):
#people.__init__(self,name,age)
super(Man,self).__init__(name,age)
self.money = money
print("%s 一出生就有 %s money..." % (self.name,self.money))
def piao(self):
print("%s is piaoing....20s...done." % self.name)
def sleep(self):
people.sleep(self)
print("man is sleeping")
class Woman(people,Relation):#女人类 继承交朋友和人类 多继承
def get_birth(self):
print("%s is born a baby" % self.name)
m1 = Man("zy",22,10)
m1.eat()
w1 = Woman("cxh",25)
m1.make_friends(w1)
标签:ati 方法 end money tin 一个 name ini man
原文地址:https://www.cnblogs.com/fgxwan/p/9617203.html