python super()函数错误?

2024-06-23 19:15:10 发布

您现在位置:Python中文网/ 问答频道 /正文

class car(object):

    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year
        self.odometer_reading = 0

class electricCar(car):
    def __init__(self, make, model, year):
        super().__init__(make, model, year)

tesla = electricCar('tesla', 'model s', 2016)
print tesla.get_descriptive_name()

TypeError: super() takes at least 1 argument (0 given)

super()函数有什么问题?


Tags: selfmakemodelobjectinitdefcaryear

热门问题