• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

'Friend' declaration

Is there something in JAVA similiar to the C++ 'Friend' declaration?  
I wish to retrieve a protected property outside of its package.

0
ScottTiger
Asked:
ScottTiger
1 Solution
 
imladrisCommented:
Package level access (the default) is as close to a friend declaration as Java goes. To get information from outside the package a method or variable must be public (an acccessor method might be appropriate) or protected (which allows subclasses to access variables and methods in superclasses (even if it is in another package)).
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now