我的问题在于继承可玩角色的属性。我有一个名为 Being 的抽象类,它声明所有继承类都需要包含诸如力量、敏捷等属性。玩家需要选择一个种族,例如将力量从 0 提高到 10 的兽人。然后玩家需要选择一个类,例如蛮力,可为英雄的力量增加 7 点。据我所知,我会被我的 Hero 类继承 2 个抽象类所困扰吗?这是我的 Orc 课程的摘录:
public abstract class Orc:Being
{
private int _strength = 10;
//Another question, is it okay to declare an abstract property in my base abstract
//class to force the inheriting class Orc to override the property? I wanted to
//find a way to force subclasses to have strength attributes
public override int Strength
{
get {return _strength;}
set {_strength = value;}
}
}