相关疑难解决方法(0)

C#"找不到合适的方法来覆盖." - 但有一个

我无法在C#中覆盖父类的方法.父类的设置如下:

public class Base {
    public Base(Game1 game)
    {
        this.game = game;
    }

    public virtual void Draw()
    {
    }
}
Run Code Online (Sandbox Code Playgroud)

......和孩子班:

public class Ext : Base {
    public Ext(Game1 game) : base(game)
    {
    }

    public override void Draw(SpriteBatch batch)
    {
    }
}
Run Code Online (Sandbox Code Playgroud)

我知道我过去成功地覆盖了一个父方法,现在我可能忽略了一些非常简单的东西......它是什么?

编辑:这实际上是一个错字:在实际的脚本中,Ext确实来自Base.问题仍然存在.但是,谢谢您的快速解答.:)

c#

27
推荐指数
3
解决办法
12万
查看次数

标签 统计

c# ×1