2

I read this answer:

The only effect the new keyword has is to remove the warning. The purpose of getting the warning when not using the new keyword is to prevent you from accidentally shadowing the method when you really meant to override it.

But why not simply make it an error? If its intended to prevent accidental hiding, why not go all the way and make it a requirement and not just a warning, so that everything is perfectly clear?

Just to be perfectly clear, I know what the keyword does. Seems like the thought process of the compiler team was 'lets add a keyword because it's good to make things clear, but let's make it optional because it's not really that important to make things clear'...

Community
  • 1
  • 1
David S.
  • 5,965
  • 2
  • 40
  • 77
  • 1
    This has been asked and answered before, search for "brittle base class" – H H Oct 01 '13 at 15:51
  • @HenkHolterman I appreciate comments, but I can't find what you mean to be the answer. I don't think StackOverflow is intended for "google it" answers (even comments). – David S. Oct 01 '13 at 15:58
  • 2
    Eric Lippert's answer [here](http://stackoverflow.com/a/3118480/517852) contains the answer to your question. Basically, you might be hiding because of an edit to a base class that you have no control over. – Mike Zboray Oct 01 '13 at 16:18

0 Answers0