This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Re: Should added members be proteced or private?
- To: java-discuss at sources dot redhat dot com
- Subject: Re: Should added members be proteced or private?
- From: Mike Kienenberger <mkienenb at alaska dot net>
- Date: Fri, 28 Jul 2000 16:20:30 -0800
Jeff Sparkes <Jeff_Sparkes@excite.com> wrote:
> I'm implementing java.awt.Polygon right now. I have
> some members that are not in the API documentation.
>
> Should I keep everything that is not in the API spec as private,
> or can I used friendly/default or protected as necessary? I assume
> I should not add anything public to the class.
One of my biggest gripes about Java is how difficult it is to subclass
due to the restrictive nature of "private". Final is another nasty
impediment to subclassing.
I'd recommend "protected". Otherwise, subclassing the object becomes
problematic.