fork download
  1. using static System.Console;
  2.  
  3. public class Test {
  4. public static void Main() {
  5. var sc = new SampleClass();
  6. IControl ctrl = (IControl)sc;
  7. ISurface srfc = (ISurface)sc;
  8. sc.Paint();
  9. ctrl.Paint();
  10. srfc.Paint();
  11. }
  12. }
  13.  
  14. interface IControl {
  15. void Paint();
  16. }
  17. interface ISurface {
  18. void Paint();
  19. }
  20. class SampleClass : IControl, ISurface {
  21. public void Paint() => WriteLine("Paint method in SampleClass");
  22. void IControl.Paint() => WriteLine("IControl.Paint");
  23. void ISurface.Paint() => WriteLine("ISurface.Paint");
  24. }
  25.  
  26. //https://pt.stackoverflow.com/q/133957/101
Success #stdin #stdout 0.02s 15884KB
stdin
Standard input is empty
stdout
Paint method in SampleClass
IControl.Paint
ISurface.Paint