Python Class Inheritance || Parent || Hierarchical Inheritance || Python
In this we are going to see a basic program of parent using hierarchical inheritance in Python Programming Language.



class gparent:
    def func4(self):
        print("Hello Grandparent")

class parent1(gparent):
    def func1(self):
        print("Hello Parent 1")


class parent2(gparent):
    def func2(self):
        print("Hello Parent 2")


gp = gparent()
p1 = parent1()
p2 = parent2()

gp.func4()
p1.func4()
p2.func4()

# Coded by Saahil


#ENJOY CODING


Post a Comment

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

Previous Post Next Post