I thing the question is about modifier
new
as in public
new void MethodNew()
, not operator
new
used for initialization. The modifier
new
is absolutely different thing, it's used to dismiss compiler warning when hiding a member.
Consider the following:
class Base {
protected void Visible() { }
}
class AccedentallyHiding : Base {
protected void Visible() { }
}
class IntentionallyHiding : Base {
protected new void Visible() { }
}
Please see code comments explaining compiler behavior.
—SA