class Sofa():
def __init__(self):
self.__color = "yellow"
print("in Sofa init")
def sitting(self):
print("can sitting!")
class Bed():
def __init__(self):
self.__color = "gray"
print("in Bed init")
def lying(self):
print("can lie down!")
class Sofabed(Bed,Sofa):
def __init__(self):
Sofa.__init__(self)
Bed.__init__(self)
self.__color = "green"
s = Sofabed()
s.sitting()
s.lying()
print(s.__dict__)
print(Sofabed.mro())
标签:__,.__,继承,self,init,print,def
From: https://www.cnblogs.com/jiyiran/p/16869099.html