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
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
