class Father():
def method_a(self):
self.method_b()
def method_b(self):
print(11111)
raise NotImplementedError("根本运行不到这里,并且这个方法一定一定要重写,否则会报错")
class Children(Father):
def method_b(self):
print("inter children")
child = Children()
child.method_a() # : inter children
输出结果为: inter children
只有Father是抽象基类的时候才可以,绝不能实例化Father,其原理可以理解为一直是Children自己调用自己的方法