假设有这个抽象类:
abstract public class MyBase {
abstract public int GetValue();
<some concrete methods here>
}
现在我想将其作为另一个抽象类继承,实现
GetValue()
但添加新的抽象方法:abstract public class MyBase2 : MyBase {
abstract public int GetValue2();
public override int GetValue() {
// some code here
return something;
}
}
我为什么要在MyBase2.GetValue()
中指定override
关键字呢?MyBase.GetValue()
已经被标记为abstract
,因此任何继承自MyBase
的内容都会自然地覆盖它,是吗?