O'Reilly logo
  • Adil Mammadov thinks this is interesting:

public class BaseClass
{
  public virtual void Foo()  { Console.WriteLine ("BaseClass.Foo"); }
}

public class Overrider : BaseClass
{
  public override void Foo() { Console.WriteLine ("Overrider.Foo"); }
}

public class Hider : BaseClass
{
  public new void Foo()      { Console.WriteLine ("Hider.Foo"); }
}

The differences in behavior between Overrider and Hider are demonstrated in the following code:

Overrider over = new Overrider();
BaseClass b1 = over;
over.Foo();   ...
            
        
			

From

Cover of C# 5.0 in a Nutshell, 5th Edition

Note

Override vs Hide