1 using System; 2 3 public abstract class Elem { getType()4 public abstract Type getType<T> (); 5 } 6 7 public sealed class TextElem : Elem { getType()8 public override Type getType<T> () { return typeof (T); } 9 } 10 11 public class OtherTextElem : Elem { getType()12 public sealed override Type getType<T> () { return typeof (T); } 13 } 14 15 public class main { Main()16 public static int Main () { 17 TextElem elem = new TextElem (); 18 19 if (elem.getType<string> () != typeof (string)) 20 return 1; 21 22 OtherTextElem oelem = new OtherTextElem (); 23 24 if (oelem.getType<string> () != typeof (string)) 25 return 1; 26 27 return 0; 28 } 29 } 30