Advertisements
Advertisements
प्रश्न
Explain multiple inheritance with the help of an example.
कोड लेखन
स्पष्ट कीजिए
Advertisements
उत्तर
In multiple inheritance, a child class inherits features from more than one parent class.
class Father(object):
def father_name(self):
print("Father: Raj")
class Mother(object):
def mother_name(self):
print("Mother: Rani")
class Child(Father, Mother):
pass
c = Child()
c.father_name()
c.mother_name()
Child can access methods of both Father and Mother.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
