can we have protected members in the sealed class?

  • Thread starter Thread starter puzzlecracker
  • Start date Start date
P

puzzlecracker

I see the "Warning new protected member declared in sealed class",
and I understand that it makes no sense to have. I wonder why it's not
prohibited altogether.
 
puzzlecracker said:
I see the "Warning new protected member declared in sealed class",
and I understand that it makes no sense to have. I wonder why it's not
prohibited altogether.

Because it doesn't actually break anything.
 
It makes it easier to change the class to and from sealed. There if no need
to prevent it. It warns you because there is a chance you have made a mistake
as you appear to intend in one place to have your class inherited from and in
another to prevent it.
 
Back
Top