继承
from basepython.c3 import Person
class Student(Person):
#子类调用父类的构造函数
def __init__(self,name,age,school):
#Person.__init__(self,name,age)
#super.__init__() 为什么这样是错误的
super(Student,self).__init__(name,age)
self.school = school
def do_homework(self):
super().eat()
print("写作业")
def eat(self):
print("意大利面")
student = Student('shigandang',18,'清华')
student.do_homework()
student.eat()
print(student.age)
print(student.name)