class Person:
def __init__(self,name,age):
self.name = name
self.age = age
def say_age(self):
print("My age is",self.age)
def say_introduce(self):
print(f"My name is {self.name}")
class Student(Person):
def __init__(self,name,age,score):
Person.__init__(self,name,age)
self.score = score
def say_introduce(self):
print(f"hello{self.name}")
s = Student("sxc",18,80)
s.say_age()
s.say_introduce()
python重写
最新推荐文章于 2024-08-15 01:55:01 发布