// http://stackoverflow.com/questions/5933045/what-if-i-dont-heed-the-warning-hides-inherited-member-to-make-the-current-me
using System;
public class Program
{
public static void Main()
B b1 = new B();
b1.F(); // will call B.F()
A b2 = new B();
b2.F(); // will call A.F()
((A)b1).F(); // will call A.F()
C c1 = new C();
c1.F(); // will call C.F()
A c2 = new C();
c2.F(); // will call A.F()
((A)c1).F(); // will call A.F()
D d1 = new D();
d1.F(); // will call D.F()
A d2 = new D();
d2.F(); // will call D.F()
((A)d1).F(); // will call D.F()
}
class A
public virtual void F()
Console.WriteLine("A.F()");
class B : A
public void F()
Console.WriteLine("B.F()");
class C : A
public new void F()
Console.WriteLine("C.F()");
class D : A
public override void F()
Console.WriteLine("D.F()");