single Inheritance in PYTHON
amannarayanm · · Python
# base class class university: university_name = "Mumbai University" def myfun(self): print("\nHello This is Base Class") class college(university): College_name = "Saket College Arts, Science and Commerce" def myfoo(self): print("\nDekho, This is Child class") c1 = college() c1.myfoo() c1.myfun() print(c1.university_name) print(c1.College_name) c1.College_name = "GyanPeath Saket" print(c1.College_name) print(college.College_name)
Click on the Run button to get started.
The code/input has changed since you last clicked on Run. Click it again to see the updated changes.