代码:
class Person: def desc(self): print("Person") class Student(Person): def desc(self): print("Student") if __name__ == '__main__': stu = Student() stu.desc()
运行结果:
Student