inheritance a function in pithon code example
Example: Inheritance example python
class Parent:
def abc(self):
print("Parent")
class LeftChild(Parent):
def pqr(self):
print("Left Child")
class RightChild(Parent):
def stu(self):
print("Right Child")
class GrandChild(LeftChild,RightChild):
def xyz(self):
print("Grand Child")
obj1 = LeftChild()
obj2 = RightChild()
obj3 = GrandChild()
obj1.abc()
obj2.abc()
obj3.abc()