This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Should added members be proteced or private?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]