0
Hi Folks, Could anyone help me with "Method Resolution Order" incase of Multilevel inheritance in python.
Do share some sample codes as well.
1 Antwort
+ 2
Method resolution works from the bottom of the inheritance tree upward.
class Base:
def foo(self):
return 'Base'
class Child(Base):
def foo(self):
return 'Child'
class Grandchild(Child):
pass
g = Grandchild()
print(g.foo())
This prints 'Child'