我今天正在做一些代码审查,并遇到了一些开发人员编写的旧代码。它是这样的
public abstract class BaseControl
{
internal abstract void DoSomething();
}
如果您在同一个程序集中有一个派生类,它会起作用
public class DerivedControl : BaseControl
{
internal override void DoSomething()
{
}
}
但是在不同的程序集中派生基类会产生编译时错误
DerivedControl does not implement inherited abstract member 'BaseControl.DoSomething()
这让我思考。为什么有人将方法声明为内部抽象?