赞 | 188 |
VIP | 627 |
好人卡 | 188 |
积分 | 95 |
经验 | 171230 |
最后登录 | 2023-6-18 |
在线时间 | 5073 小时 |
Lv4.逐梦者 (版主)
- 梦石
- 0
- 星屑
- 9497
- 在线时间
- 5073 小时
- 注册时间
- 2013-6-21
- 帖子
- 3580
|
super calls the method of the parent class, if it exists. Also, as @EnabrenTane pointed out, it passes all the arguments to the parent class method as well.
翻译:super 会将该方法的参数原封不动地传给父类同名方法(如果有的话)。
你的 initialize 里面有 id = 0 这个默认参数,因此 super 会传一个额外的参数给父类的方法,但是实际上父类不需要这个参数,所以报错。
解决办法:将 super 改为 super() |
评分
-
查看全部评分
|