多继承执行顺序问题
class Person(object):
def __init__(this):
print "init Person..."
class Student(Person):
def __init__(this):
super(Student,this).__init__()
print "init Student..."
def Sdent(this):
print "i am a student..."
class Teacher(Person):
def __init__(this):
super(Teacher,this).__init__()
print "init Teacher..."
def Tcher(this):
print "i am a tercher..."
class SkillMixin(object):
def __init__(this):
print "init SkillMixin..."
class BasketballMixin(SkillMixin):
def __init__(this):
super(BasketballMixin,this).__init__()
print "init BasketballMixin..."
def skill(self):
return 'basketball'
class FootballMixin(SkillMixin):
def __init__(this):
super(FootballMixin,this).__init__()
print "init FootballMixin..."
def skill(self):
return 'football'
class BStudent(Student,BasketballMixin):
def __init__(this):
super(BStudent,this).__init__()
print "Bstudent..."
class FTeacher(Teacher,FootballMixin):
def __init__(this):
super(FTeacher,this).__init__()
print "FTeacher...."
s = BStudent()
#print s.Sdent
#print s.skill()
t = FTeacher()
#print t.skill()
#print t.Tcher()
输出结果:
init Person...
init Student...
Bstudent...
init Person...
init Teacher...
FTeacher....
和这个兄弟的不同:http://blog.csdn.net/caiknife/article/details/8579851
请大家帮我分析一波!!谢谢