Steve wrote:
Thanks John. I had the idea in my head that access levels tightened
up 1 notch with inheritance. I think I am mixing up C++ rules for
Java.
An oft-overlooked access level is "default" (a.k.a. "package-
private"), which is the level when there is no other access keyword
('public', 'protected' or 'private'). This creates package-friendly
access, allowing access (and inheritance) for types in the same
package but not otherwise.
For real fun, consider an inner class that inherits from its
containing type:
package eg;
public class Foo
{
/* p-p */ void packageFriendly()
{
System.out.println( "Foo#packageFriendly()" );
}
private void hiddenInside()
{
System.out.println( "Foo#hiddenInside()" );
}
class InnerFoo extends Foo
{
void packageFriendly()
{
System.out.println( "InnerFoo#packageFriendly()" =
declared package-private.