- Implementing inheritance with more than level is called Multi Level Inheritance.
- We can access the complete functionality of all objects using Child object reference.
class Grand:
def m1(self):
print("Grand Parent m1()")
return
class Parent(Grand):
def m2(self):
super().fun()
print("Parent m2()")
return
class Child(Parent):
def m3(self):
super().fun()
print("Child m3()")
return
class Inheritance:
def main():
c = Child()
c.m1()
c.m2()
c.m3()
p = Parent()
p.m1()
p.m2()
p.m3() # error
g = Grand()
g.m1()
g.m2() #error
g.m3() #error
return
Inheritance.main()