using static System.Console;
class A {
virtual public void metodo1() => WriteLine("A");
public void metodo2() => WriteLine("A");
}
class B : A {
override public void metodo1() => WriteLine("B");
public void metodo2() => WriteLine("B");
}
public class HelloWorld {
public static void Main() {
A a = new A();
a.metodo1();
A b = new B();
b.metodo1();
A c = new B();
c.metodo2();
}
}
//https://pt.stackoverflow.com/q/89218/101
dXNpbmcgc3RhdGljIFN5c3RlbS5Db25zb2xlOwoJCQkJCQpjbGFzcyBBIHsKICAgIHZpcnR1YWwgcHVibGljIHZvaWQgbWV0b2RvMSgpID0+IFdyaXRlTGluZSgiQSIpOwogICAgcHVibGljIHZvaWQgbWV0b2RvMigpID0+IFdyaXRlTGluZSgiQSIpOwp9CmNsYXNzIEIgOiBBIHsKICAgIG92ZXJyaWRlIHB1YmxpYyB2b2lkIG1ldG9kbzEoKSA9PiBXcml0ZUxpbmUoIkIiKTsKICAgIHB1YmxpYyB2b2lkIG1ldG9kbzIoKSA9PiBXcml0ZUxpbmUoIkIiKTsKfQoKcHVibGljIGNsYXNzIEhlbGxvV29ybGQgewogICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkgewogICAgICAgIEEgYSA9IG5ldyBBKCk7CiAgICAgICAgYS5tZXRvZG8xKCk7CiAgICAgICAgQSBiID0gbmV3IEIoKTsKICAgICAgICBiLm1ldG9kbzEoKTsKICAgICAgICBBIGMgPSBuZXcgQigpOwogICAgICAgIGMubWV0b2RvMigpOwogICAgIH0KfQoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvODkyMTgvMTAx