The new modifier is used to eliminate the warning caused by hiding an inherited name e.g the same signature as one in the base class.
class Base
{
public void F(int n) {}
}
class Derived: Base
{
//public void F(int n ) {} // Warning, hiding an inherited name
new public void F(int n) {} // Solved by using new
}
Hiding an inherited name is specifically not an error, since that would preclude separate evolution of base classes.
For example, the above situation might have come about because a later version of Base introduced an F method that wasn't present in an earlier version of the class.
Had the above situation been an error, then any change made to a base class in a separately versioned class library could potentially cause derived classes to become invalid.
An override method provides a new implementation of a member inherited from a base class.
The method overridden by an override declaration is known as the overridden base method.
The overridden base method must have the same signature as the override method.
You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override.
obislavu