Python Super init || Multilevel Inheritance || Python
In this we are going to see a basic program on multilevel inheritance using super() in Python Programming Language.


class First:
    def __init__(self):
      print("First Constructor")

    def display(self,val):
      print("Display Value : ",val)

class Second(First):
   def __init__(self):
     print("Second Constructor")
     super().__init__()

   def display1(self,val):
     print("Display Value : ", val)
     super().display(val+1)

class Third(Second):
   def __init__(self):
     print("Third Constructor")
     super().__init__()

   def display2(self,val):
     print("Display Value : ",val)
     super().display1(val+1)
 
ob =Third()
ob.display(10)

# Coded By Dhiraj Shelke

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post