3
从基类调用时,GetType()是否会返回派生最多的类型?
从基类调用时,GetType()是否会返回派生最多的类型? 例: public abstract class A { private Type GetInfo() { return System.Attribute.GetCustomAttributes(this.GetType()); } } public class B : A { //Fields here have some custom attributes added to them } 还是我应该使派生类必须实现的抽象方法如下所示? public abstract class A { protected abstract Type GetSubType(); private Type GetInfo() { return System.Attribute.GetCustomAttributes(GetSubType()); } } public …