被覆盖的方法完全替换了父类的方法:
class Msg:
def proc(self):
# this part is common to all methods
print("common part")
# I would like the override to start here
pass
class A(Msg):
def proc(self):
# this should be appended below pass above
print("overridden part")
A().proc()
是否可以通过保留“公共”部分并附加一个特定的部分(每个类)来部分替换该方法?