Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: Networks on March 13, 2005, 12:57:40 pm

Title: [Java] Friend Scoping
Post by: Networks on March 13, 2005, 12:57:40 pm
What's the difference between scoping a variable or object as public and friend? You seem to have the same amount of access if the variable or object was public if you declared it to be friend and vise versa.
Title: Re: [Java] Friend Scoping
Post by: iago on March 13, 2005, 01:42:32 pm
There are friends? I never knew that.

Ok, Networks clarified: I know these "friend" variables as "package protection".

The idea of package protection is that only classes within their package can access them.  Any class in a different package can't.  In public, anything (in or out of their package) is allowed to access them.

I don't recommend ever using package protection.