Should added members be proteced or private?

Mike Kienenberger mkienenb@alaska.net
Fri Jul 28 17:20:00 GMT 2000


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.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /