0

Hi Folks, Could anyone help me with "Method Resolution Order" incase of Multilevel inheritance in python.

Do share some sample codes as well.

10th May 2018, 5:08 AM
Karan Chaudhary
Karan Chaudhary - avatar
1 Odpowiedź
+ 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'
9th Jun 2018, 3:14 AM
1_coder