fork download
  1. using System;
  2.  
  3. public static class Test
  4. {
  5. public class ClassA {}
  6. public class ClassB {}
  7.  
  8. public static void method<T>(T objA) where T : ClassA {
  9. Console.WriteLine("MethodA");
  10. }
  11.  
  12. public static void method<T>(T objB) where T : ClassB {
  13. Console.WriteLine("MethodB");
  14. }
  15.  
  16. public static void Main()
  17. {
  18. ClassA obja = new ClassA();
  19. ClassB objb = new ClassB();
  20.  
  21. method(obja);
  22. method(objb);
  23. }
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(12,21): error CS0111: A member `Test.method<T>(T)' is already defined. Rename this member or use different parameter types
prog.cs(8,21): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty