Junior
From PDF
OOP
C# OOP
What is the difference between new and override in inheritance?
- override → Overrides a virtual method in base class (runtime polymorphism).
- new → Hides a base class method (compile-time hiding, not true overriding).
class Vehicle { public void Start() => Console.WriteLine("Vehicle");
}
class Car : Vehicle { public new void Start() =>
Console.WriteLine("Car"); }
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png