类-继承
2020-11-08 本文已影响0人
杨伊春
class Person:
def __init__(self,name,age):
self.name = name
self.age = age
class Student(Person):
def __init__(self,name,age,score):
super().__init__(self,name,age) //调用父类的方法
self.score=score
class Person:
def __init__(self,name,age):
self.name = name
self.age = age
class Student(Person):
def __init__(self,name,age,score):
super().__init__(self,name,age) //调用父类的方法
self.score=score