What is the difference between overriding and hiding (override vs new)?
Short answer
override replaces a virtual/abstract base member and uses run-time (polymorphic) dispatch; new hides the base member and dispatch depends on the compile-time type, which is usually a bug.
Advertisement
AModel answer
override replaces a virtual/abstract base member and uses run-time (polymorphic) dispatch; new hides the base member and dispatch depends on the compile-time type, which is usually a bug.
class B { public virtual void Go()=>Console.Write("B"); }
class D : B { public override void Go()=>Console.Write("D"); }Real-world example
Overriding lets a PdfReport customise Render() while base code calls it polymorphically.