Inner Class === ```python= # create outer class class Doctors: def __init__(self): self.name = 'Doctor' self.den = self.Dentist() self.car = self.Cardiologist() def show(self): print('In outer class') print('Name:', self.name) # create a 1st Inner class class Dentist: def __init__(self): self.name = 'Dr. Savita' self.degree = 'BDS' def display(self): print("Name:", self.name) print("Degree:", self.degree) # create a 2nd Inner class class Cardiologist: def __init__(self): self.name = 'Dr. Amit' self.degree = 'DM' def display(self): print("Name:", self.name) print("Degree:", self.degree) ``` ## Ref. [Inner Class in Python]([https://](https://www.geeksforgeeks.org/inner-class-in-python/)) ###### tags: `語法相關`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up