class Super:
def method(self):
print('super method')
def delegate(self):
self.action()
class Inheritor(Super):
pass
class Replacer(Super):
def method(self):
print('replacer.method')
class Extender(Super):
def method(self):
print('extender.method')
Super.method(self)
print('ending extend.method')
class Provider(Super):
def action(self):
print('provider.action')
if __name__ == '__main__':
for i in (Inheritor,Replacer,Extender):
print(i.__name__)
i().method()
x = Provider()
x.delegate()
'''
Inheritor
super method
provider.action
Replacer
replacer.method
provider.action
Extender
extender.method
super method
ending extend.method
provider.action
'''