fork download
  1. using System;
  2.  
  3. class A {
  4. public int x = 0;
  5. public void f () { Console.WriteLine ( "A:f" ); } }
  6.  
  7. class B : A {
  8. public int x = 1;
  9. public void f () { Console.WriteLine ( "B:f" ); } }
  10.  
  11. public class Program {
  12. public static void Main ( String [] args ) {
  13. A a = new A ();
  14. B b = new B ();
  15. A ab = new B ();
  16.  
  17. a.f();
  18. b.f();
  19. ab.f();
  20. Console.WriteLine ( a.x );
  21. Console.WriteLine ( b.x );
  22. Console.WriteLine ( ab.x ); } }
Success #stdin #stdout 0.03s 36968KB
stdin
Standard input is empty
stdout
A:f
B:f
A:f
0
1
0