fork download
  1. using static System.Console;
  2.  
  3. class A {
  4. virtual public void metodo1() => WriteLine("A");
  5. public void metodo2() => WriteLine("A");
  6. }
  7. class B : A {
  8. override public void metodo1() => WriteLine("B");
  9. public void metodo2() => WriteLine("B");
  10. }
  11.  
  12. public class HelloWorld {
  13. public static void Main() {
  14. A a = new A();
  15. a.metodo1();
  16. A b = new B();
  17. b.metodo1();
  18. A c = new B();
  19. c.metodo2();
  20. }
  21. }
  22.  
  23. //https://pt.stackoverflow.com/q/89218/101
Success #stdin #stdout 0.02s 15812KB
stdin
Standard input is empty
stdout
A
B
A