Python3方法重写

代码:

class Person:
    def desc(self):
        print("Person")
 
class Student(Person):
     def desc(self):
         print("Student")
 
if __name__ == '__main__':
      stu = Student()
      stu.desc()

运行结果:

Student

 

posted @ 2019-09-10 21:52  Jumpkin1122  阅读(168)  评论(0编辑  收藏  举报