class father():
def call_children(self):
child_method = getattr(self, 'out')# 获取子类的out()方法
child_method() # 执行子类的out()方法
class children(father):
def out(self):
print "hehe"
if __name__ == "__main__":
child = children()
child.call_children()
Python父类调用子类方法
3127 views