Advertisements
Advertisements
प्रश्न
What is multiple inheritance? Explain with an example.
कोड लेखन
स्पष्ट कीजिए
Advertisements
उत्तर
Multiple inheritance occurs when one derived class inherits from two or more base classes.
class Student(object):
def student_info(self):
print("Student details")
class Teacher(object):
def teacher_info(self):
print("Teacher details")
class School(Student, Teacher):
pass
s = School()
s.student_info()
s.teacher_info()
Here, School inherits methods from both Student and Teacher.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
