fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5.  
  6. class OOP { }
  7. class CPP : OOP { }
  8. class JAVA : OOP { }
  9. class CS : OOP { }
  10.  
  11. static void pituh(CPP x, CPP y){
  12. Console.WriteLine("C++ sosnooley");
  13. }
  14.  
  15. static void pituh(CPP x, JAVA y){
  16. Console.WriteLine("C++ vs JAVA");
  17. }
  18.  
  19. static void pituh(CS x, CS y){
  20. Console.WriteLine("C# has multimethods");
  21. }
  22.  
  23. static void pituh(OOP x, OOP y){
  24. Console.WriteLine("default");
  25. }
  26.  
  27.  
  28.  
  29. static void d(OOP x, OOP y)
  30. {
  31. dynamic a = x;
  32. dynamic b = y;
  33. pituh(a, b);
  34. }
  35.  
  36. public static void Main(string[] args)
  37. {
  38. d(new JAVA(),new CS());
  39. d(new CPP(),new JAVA());
  40. d(new CPP(),new CPP());
  41. d(new CS(),new CPP());
  42. d(new CS(),new CS());
  43. }
  44. }
  45.  
Success #stdin #stdout 0.24s 34876KB
stdin
Standard input is empty
stdout
default
C++ vs JAVA
C++ sosnooley
default
C# has multimethods