'''
super可以代指父类。
可以使用super关键字调用init方法,
语法格式:super(子类,self).__init__(参数1,参数2,…)
效果等同于:父类名称.__init__(self,参数1,参数2,…)
'''
class Father():
def __init__(self, name, house):
self.name = name
self.house = house
def work(self):
print("挣钱养家")
class Son(Father):
def __init__(self, name, house, toy):
super(Son, self).__init__(name, house)
# Father.__init__(self, name, house)
self.toy = toy
son1 = Son("son", "h", "t")
print(son1.toy)
print(son1.house)