can we have protected members in the sealed class?

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.
 
A

Anthony Jones

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.
 
C

Ciaran O''Donnell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top