fork download
  1. using System;
  2.  
  3. public interface Foo
  4. {
  5. Foo foo();
  6. }
  7.  
  8. class Foo_int : Foo
  9. {
  10. private int content = 0;
  11.  
  12. public Foo_int(int content)
  13. {
  14. this.content = content;
  15. }
  16.  
  17. public Foo foo()
  18. {
  19. return new Foo_int(content + 1);
  20. }
  21.  
  22. public override string ToString()
  23. {
  24. return content.ToString();
  25. }
  26. }
  27.  
  28. public class Test
  29. {
  30. public static Foo bar(Foo x)
  31. {
  32. return x.foo();
  33. }
  34.  
  35. public static void Main()
  36. {
  37. var x = new Foo_int(1);
  38. Console.WriteLine(bar(x));
  39. }
  40. }
Success #stdin #stdout 0.03s 33888KB
stdin
Standard input is empty
stdout
2