且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

初学者编码,请帮忙

更新时间:2023-11-16 19:03:04

构造函数是
__init__

(注意双下划线),而不是

(note double underscores), not

_init_


除了Carlo发现的错误之外:

- 你不需要声明 name , hp damage ,因为已经定义了在角色

- 战斗机刺客类在 prof 属性之前需要 self 关键字。
In addition to Carlo's well spotted mistake:
- You do not need to declare name, hp and damage in your subclasses, as the are already defined in Character.
- The Fighter and Assassin classes need the self keyword before the prof attribute.