更新时间: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 declarename
,hp
anddamage
in your subclasses, as the are already defined inCharacter
.
- TheFighter
andAssassin
classes need theself
keyword before theprof
attribute.