In superclass in Python
, how can I call the function that's overridden in its subclass?
class A:
@staticmethod
def interfaceBasedMethod():
print "Want to delegate to overriding method in subclass"
@staticmethod
def a():
interfaceBasedMethod() # <-- I know this causes error. But here
# I want to call the overridden method in subclass.
class B(A):
@staticmethod
def interfaceBasedMethod():
print "Class B processes."
if __name__ == "__main__":
b=B
b.a()
Ideal output:
Class B processes.
Google search doesn't really return pages about Interface-Based Programming in Python, although it should be common in Java etc. Thanks!