我试着在这里制作一个玩具类
class Toy:
def __init__(self,name,ID,price,age):
self.__ToyName = name
self.__ToyID = ID
self.__Price = price
self.__MinimumAge = int(age)
##some methods here
当我尝试制作一个子类计算机游戏时,我需要制作7个参数(玩具类中有5个)来实例化计算机游戏类,它显示“太多争论(7/5)”
class ComputerGame(Toy):
def __init__(self,name,ID,price,age,catogory,console):
Toy.__init__(self,name,ID,price,age)
self.__Catogory = catogory
self.__Console = console
这种情况我该怎么办?
您需要了解更多有关super
的信息
class ComputerGame(Toy):
def __init__(self, name, ID, price, age, catogory, console):
super(ComputerGame, self).__init__(name, ID, price, age)
self.__Catogory = catogory
self.__Console = console