MSDN says:
When used as a modifier, the new keyword explicitly hides a member inherited from a base class. When you hide an inherited member, the derived version of the member replaces the base-class version. Although you can hide members without the use of the new modifier, the result is a warning. If you use new to explicitly hide a member, it suppresses this warning and documents the fact that the derived version is intended as a replacement.
Example:
class Base
{
int value;
virtual bool Foo()
{
value++;
}
}
class Derived : Base
{
int value;
override bool Foo()
{
value++;
}
}
Do I have to add new
modifier to Derived.value declaration? What changes?