#多继承
#若是父类中有相同的方法名,而在子类使用时未指定,python从左至右搜索 即方法在子类中未找到时,从左到右查找父类中是否包含方法。方法名同,默认调用的是在括号中排前的父类的方法
#class people:
# name=''
# age=0
# _weight=0
# def __init__(self,n,a,w):
# self.name=n
# self.age=a
# self._weight=w
# def speak(self):
# print("%s说:我%d岁。"%(self.name,self.age))
#class student(people):
# grade=''
# def __init__(self,n,a,w,g):
# people.__init__(self,n,a,w)
# self.grade=g
# def speak(self):
# print("%s说:我%d岁,我在读%d年级"%(self.name,self.age,self.grade))
#class speaker():
# topic=''
# name=''
# def __init__(self,n,t):
# self.name=n
# self.topic=t
# def speak(self):
# print("我叫%s,我是一个演说家,我演讲的主题是%s。"%(self.name,self.topic))
#class sample(speaker,student):
# a=''
# def __init__(self,n,a,w,g,t):
# student.__init__(self,n,a,w,g)
# speaker.__init__(self,n,t)
#test=sample("Tim",25,80,4,"Python")
#test.speak()