class vehicle:
def __init__(self,type):
self.type=type
def move(self):
print('交通工具可以移动')
class airplane(vehicle):
def __init__(self,type,color):
super().__init__(type) //super这种写法不会报错
self.color=color
def move(self):
print('飞机飞')
class train(vehicle):
def __init__(self,type,color):
super(vehicle, self).__init__(type) //super这种写法会报错
self.color=color
def move(self):
print('火车在铁轨上移动')
a1=airplane(111,222)
a1.move()
t1=train('火车','白色')
t1.move()
super(vehicle, self).__init__(type)
TypeError: object.__init__() takes exactly one argument (the instance to initialize)