摘要:
下文讲述Python中”调用父类方法”的方法分享,如下所示;
当父类中的方法被子类重写后,我们在子类中如何调用父类的方法呢?
下文将一一道来,如下所示:
实现思路: 只需使用父类名称加方法名即可调用父类中的方法
例:
调用父类方法的示例分享
#maomao365.com #Python 运行父类方法的示例分享 class parent(object): def funTest(): print("parent function") class child(parent): def funTest(self): #调用父类方法 parent.funTest(); print("child function") t = child(); t.funTest(); //输出 parent function child function