关于多重继承的问题,请大神指教
class Person(object): def __init__(self, name, sex, age): self.name = name self.sex = sex self.age = age class Student(Person): def __init__(self, name, sex, age, score): super(Student, self).__init__(name, sex, age) self.score = score class Teacher(Person): def __init__(self, name, sex, age, subject): super(Teacher, self).__init__(name, sex, age) self.subject = subject class School(Student, Teacher): def __init__(self, name, sex, age, subject, score, mcl): super(Student, self).__init__(name, sex, age, score) super(Student, self).__init__(name, sex, age, subject) self.mcl = mcl def f(self): return 'name:%s\n sex:%s\n age:%s\n subject:%s\n score:%s\n class:%s' % ( self.name, self.sex, self.age, self.subject, self.score, self.mcl) def g(x): print(x.f()) p = School('xiaowang', '男', 20, '体育', '90', '二班') print(g(p))
这样写,问题出在哪呀?