我有一个抽象类,它有一个基于其他派生类的抽象方法。我收到一条错误消息,上面写着 Expected class、delegate、enum、interface 或 struct,红线位于 bool 下。我知道{}
大括号中应该有更多代码只是我需要它来询问汽车是否仍在运行,这 IsDead()
就是全部
namespace Car Racer
{
public abstract class Racer
{
private string racerName;
private int racerSpeed;
private Engine engine;
public Racer()
{
}
public Racer(string _name, int _speed, Engine _engine)
{
racerName = name;
racerSpeed = speed;
Engine = engine;
}
public string Engine()
{}
private int cylinders = 0;
private int engineHorsePower = 0;
}
public abstract bool IsDead();
}
}
还有一个错误,指出类型或命名空间定义,或
最后一个大括号下的红线预期的文件结尾}