2 using System
.Reflection
;
6 public static int Main ()
8 MethodInfo m
= typeof (SubTestClass
).GetMethod ("get_name");
9 MethodInfo bm
= m
.GetBaseDefinition ();
10 if (bm
== null || bm
.DeclaringType
!= typeof (TestClass
) || bm
.Name
!= "get_name") return 1;
12 m
= typeof (SubTestClass
).GetMethod ("get_name2");
13 bm
= m
.GetBaseDefinition ();
14 if (bm
== null || bm
.DeclaringType
!= typeof (TestClass
) || bm
.Name
!= "get_name2") return 2;
16 m
= typeof (SubTestClass
).GetMethod ("get_name3");
17 bm
= m
.GetBaseDefinition ();
18 if (bm
== null || bm
.DeclaringType
!= typeof (BaseTestClass
) || bm
.Name
!= "get_name3") return 3;
24 abstract class BaseTestClass
26 public abstract string name3
33 abstract class TestClass
: BaseTestClass
35 public abstract string name
40 public virtual string name2
46 class SubTestClass
: TestClass
48 public override string name
53 public override string name2
58 public override string name3