fork download
  1. using System;
  2.  
  3. class Evil
  4. {
  5. public new Type GetType() => typeof(SonOfEvil);
  6. }
  7.  
  8. class SonOfEvil : Evil {}
  9. class DaughterOfEvil : Evil {}
  10.  
  11. public class Test
  12. {
  13. public static void Main()
  14. {
  15. Evil e = new DaughterOfEvil();
  16. if (e.GetType() == typeof(SonOfEvil))
  17. Console.WriteLine("похож на SonOfEvil");
  18. }
  19. }
Success #stdin #stdout 0.01s 131648KB
stdin
Standard input is empty
stdout
похож на SonOfEvil