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 …