Understanding class access



Hello,

let's say I'm writing a extension organized in packages such as:

mycompany.mypackage.MyClass
mycompany.mypackage.subpackage.MySubClass

The people who are going to use my extension will extend MyClass. So I
declare it to be public.

But I don't want people to be able to access MySubClass, so I can't
declare as public. But I want MyClass to be able to access MySubClass,
and if I don't declare MySubClass to be public, the compiler complains
that MySubClass is in a different package and must be public.

(I hope I'm being clear here :-)

Is there anyway that I can access MySubClass from MyClass, but make
MySubClass invisible for packages outside mycompany.mypackage?

Thank you in advance,

André

.



Relevant Pages

  • Re: Understanding class access
    ... The people who are going to use my extension will extend MyClass. ... declare it to be public. ... But I want MyClass to be able to access MySubClass, ... MySubClass invisible for packages outside mycompany.mypackage? ...
    (comp.lang.java.programmer)
  • Re: Understanding class access
    ... The people who are going to use my extension will extend MyClass. ... declare it to be public. ... But I want MyClass to be able to access MySubClass, ... MySubClass invisible for packages outside mycompany.mypackage? ...
    (comp.lang.java.programmer)