I am new to python
and asking very basic question. I am trying to understand multiple inheritance. I have two parent classes i.e Speciy and Living and one child class Bird but when i run the following program, i get error 'Bird' object has no attribute '_Living__house'
.Please tell me what i am doing wrong
But when i use single inheritance i.e class Bird(Speciy) or class Bird(Living)
it works fine. So only the error comes when i use multiple inheritence
class Speciy:
def __init__(self,legs=4,colour="White"):
self.__legs=legs
self.__colour=colour
def get_legs(self):
return self.__legs
def set_legs(self,legs):
self.__legs=legs
def get_colour(self):
return self.__colour
def set_colour(self,colour):
self.__colour=colour
class Living:
def __init__(self,house="city"):
self.__house=house
def get_house(self):
return self.__house
def set_house(self,house):
self.__house=house
class Bird(Speciy,Living):
def __init__(self,wings=2):
super().__init__()
super().__init__()
self.__wings=wings
def get_wings(self):
return self.__wings
def set_wings(self,wings):
self.__wings=wings
b1=Bird(4)
print(b1.get_wings())
b1.set_colour("Green")
print(b1.get_colour())
print(b1.get_house())