Hiding vs. Overriding a Method
Learn how to control polymorphic behavior in C# by distinguishing between hiding methods with new and overriding them with override.
We'll cover the following...
We'll cover the following...
Hiding defines a method in a derived class that shares the name and signature of a method in the base class.
Unlike overriding, which modifies the implementation of an existing virtual method, hiding creates a distinct method that functions independently of the base version. To explicitly declare that we intend to hide a method, we use the new keyword.
We begin by defining a base class that contains the method we intend to hide.