What could have been the design decision behind restricting a class to either public or default level access? The protected member is more visible than a default, then why skip protected?
EDIT: I meant TOP level classes
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The visibility level of classes is not the same as that of members!
With members the whole idea of subclassing comes into play, hence the notion of “protected.”
But with classes, you are either visible outside your package or you are not. There is no real notion of being or not being visible to your subclasses. It would be odd, wrong actually, if a subclass could not see its superclass.
In addition, subpackages don’t really work like subclasses, so again, “protected” on classes just really doesn’t work.
BTW we are talking here of top-level classes, right? Member classes are a different story.