-
What's up with protected access in JAVA?
Can anybody explain to me why the protected access specifier allows all classes within a package to access the protected member variable instead of only allowing derived classes to access the protected member variable like in C++.
Thanks a million,
-V
-
The use of a package means that there is a relationship among the classes in the package. They are designed to work together, support each other, provide service to each other.
It can be seen as providing "friend" functionality to Java.
If you don't want to give classes this kind of access, make the method/field private, or don't create a package.
Similar Threads
-
By Rob Abbe in forum Talk to the Editors
Replies: 44
Last Post: 01-13-2003, 02:57 PM
-
By Sean in forum VB Classic
Replies: 6
Last Post: 07-23-2002, 08:04 PM
-
By Michelle in forum VB Classic
Replies: 8
Last Post: 04-19-2002, 05:01 PM
-
By Denijal Sarajliĉ in forum ASP.NET
Replies: 0
Last Post: 12-25-2000, 07:45 AM
-
Replies: 0
Last Post: 06-16-2000, 02:10 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|