class father():
def call_children(self):
child_method = getattr(self, 'out')# 获取子类的out()方法
child_method() # 执行子类的out()方法

class children(father):
def out(self):
print "hehe"

child = children()
child.call_children()

相关文章:

  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案