The new modifier instructs the compiler to use the new implementation instead of the base class function. Whereas, Override modifier helps to override the base class function.
virtual: indicates that a method may be overridden by an inheritor
override: Overrides the functionality of a virtual method in a base class, providing different functionality.
new: Hides the original method (which doesn't have to be virtual), providing different functionality. This should only be used where it is absolutely necessary.
When you hide a method, you can still access the original method by upcasting to the base class. This is useful in some scenarios, but dangerous.
Posted Date:- 2021-09-30 00:05:25