Python Inner Class - Inheritance || Inner Class || Python
In this we are going to see a basic example of inner class - inheritance in Python Programming Language.



class A:
    def __init__(self):
        self.db = self.Inner()
    def display(self):
        print('Inside the Parent Class')   

    class Inner:
        def display1(self):
            print('Inner Of Parent Class')
class B(A):
    def __init__(self):
        print('Inside the Child Class')
        self.db2 = self.Inner()
        super().__init__()  

    class Inner(A.Inner):
        def display2(self):
            print('Inner class Of Child Class')

p = B()
p.display()  
x = p.db
x.display1()
y = p.db2
y.display2()

# 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