Inner Class in Python
Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python
Program 1
#Inner Class in Python
# class TestOuter:
# def __init__(self):
# print("Hello i am init method of outer class")
# class TestInner:
# def __init__(self):
# print("Hello i am init method of inner class")
# @staticmethod
# def display():
# print("Hello i am display method of inner class")
#T1=TestOuter()
# T2=TestOuter.TestInner()
# T2.display()
# TestOuter.TestInner.display()
#
class Country:
def display(self):
print("India")
class State:
def display(self):
print("MP")
class City:
def display(self):
print("Indore")
C1=Country()
S1=Country.State()
Ct=Country.State.City()
C1.display()
S1.display()
Ct.display()
Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

