fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. var sta = new SomeType<A>();
  8. sta.Do(new A());
  9. }
  10. }
  11.  
  12. public class SomeType<T> where T : Z
  13. {
  14. public void Do(T t)
  15. {
  16. t.Foo();
  17. t.Bar();
  18. }
  19. }
  20.  
  21. public interface X { void Foo(); }
  22.  
  23. public interface Y { void Bar(); }
  24.  
  25. public interface Z : X, Y { }
  26.  
  27. public class A : Z
  28. {
  29. public void Foo() {}
  30. public void Bar() {}
  31. }
  32.  
  33. public class B : Z
  34. {
  35. public void Foo() {}
  36. public void Bar() {}
  37. }
Success #stdin #stdout 0.01s 23984KB
stdin
Standard input is empty
stdout
Standard output is empty