In C# there is a new
member modifier used to explicitly hides a member that is inherited from a base class. If this modifier is missing when it is required, compiler produces a warning. This looks reasonable from backward compatibility perspective (to not to break compilation of the code written when there was no new
). However this modifier can be put on all members, even if these members do not hide any base members, and it will only produce a warning from the compiler about redundant new
modifier.
What are possible reasons to limiting it with a warning and not an error? Redundant new
modifiers produce confusion pretending to hide something, when in reality it's not true. I know that the compiler most likely can be configured to treat this warning as error, but I'm curios what the original intent could be to enable default behavior as "warning".