DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Dec 2003
    Posts
    38

    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

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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

  1. DevX does seem one sideded
    By Rob Abbe in forum Talk to the Editors
    Replies: 44
    Last Post: 01-13-2003, 02:57 PM
  2. how to access password protected database?
    By Sean in forum VB Classic
    Replies: 6
    Last Post: 07-23-2002, 08:04 PM
  3. Access 97 to 2000 Conversion Error
    By Michelle in forum VB Classic
    Replies: 8
    Last Post: 04-19-2002, 05:01 PM
  4. Replies: 0
    Last Post: 12-25-2000, 07:45 AM
  5. Replies: 0
    Last Post: 06-16-2000, 02:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links