Can somebody please explain me why is PROTECTED considered to be more restrictive than DEFAULT?
I think it should be the other way around. Let me explain:
DEFAULT:
member visible to other classes in the same package
PROTECTED:
member visible to other classes in the same package
+
member visible to subclasses outside the package (through inheritance)
That means that in the same conditions:
"Number of classes that can access PROTECTED member" > "Number of classes that can access DEFAULT member"
by this we can say that DEFAULT restricts the access to a smaller group of classes than PROTECTED does ---> DEFAULT is being more restrictive!
You're both right. Default is in fact more restrictive than protected.
I read somewhere that stated (erroneously) that protected was more restrictive than default... damn it!
Well, that makes both of you and my intuition right