【发布时间】:2011-04-14 17:35:05
【问题描述】:
我的情况是这样的:
public class InheritedClass : BaseClass
{
public override void SomeMethod()
{
AnotherMethod();
}
public override void AnotherMethod()
{
}
}
public class BaseClass
{
public virtual void SomeMethod()
{ }
public virtual void AnotherMethod()
{ }
}
那么当我调用InheritedClassInstance.SomeMethod 时会调用哪个方法呢?它是调用InheritedClassInstance.AnotherMethod,还是BaseClass 的AnotherMethod?
【问题讨论】:
标签: c# inheritance method-resolution-order