In this we are going to see a basic program to define professor name and department in inner class in Python Programming Language.
class Dept:
def __init__(self, dname):
self.dname = dname
class Teacher:
def __init__(self,pname):
self.pname = pname
math = Dept("Mathematics")
mathTeacher = Dept.Teacher("Abhishek")
print(math.dname)
print(mathTeacher.pname)
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP