python 调用未绑定的超类构造方法
class Bird:
def __init__(self):
self.hungry = True
def eat(self):
if self.hungry:
print('Aaaaah')
self.hungry = False
else:
print('No. thanks')
class SongBird(Bird):
def __init__(self):
Bird.__init__(self)
self.sound = 'squawk'
def sing(self):
print(self.sound)
class SongBird(Bird):
def __init__(self):
super(SongBird, self).__init__()
self.sound = 'squawk'
def sing(self):
print(self.sound)