Re: Understanding class access
- From: angrybaldguy@xxxxxxxxx
- Date: 31 May 2007 10:07:00 -0700
On May 31, 9:33 am, André Wagner <andre....@xxxxxxxxx> wrote:
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é
If you don't want MySubClass to be subclassed, declare it final --
that's what it's there for.
.
- Follow-Ups:
- Re: Understanding class access
- From: André Wagner
- Re: Understanding class access
- References:
- Understanding class access
- From: André Wagner
- Understanding class access
- Prev by Date: Re: Understanding class access
- Next by Date: Re: JSP Loading Page... Please wait while my code doesn't work!
- Previous by thread: Re: Understanding class access
- Next by thread: Re: Understanding class access
- Index(es):
Relevant Pages
|