Daniel Rall wrote:
>
> "Geir Magnusson Jr." <[EMAIL PROTECTED]> writes:
>
> > Eric Dobbs wrote:
> > >
> > > On Wednesday, June 20, 2001, at 09:21 PM, Geir Magnusson Jr. wrote:
> > >
> > > > Daniel Rall wrote:
> > > >>
> > > >> Boiled down from a discussion w/ jvz on IRC:
> > > >>
> > > >> Classes implementing a given piece of functionality that don't
> > > >> absolutely need to be public (such as those which are only used
> > > >> internally by that functionality), should provide only a package or
> > > >> derivitative-accessible API (default or protected access for both
> > > >> class and methods).
> > > >>
> > > >
> > > > Doesn't this mean that if the said class isn't declared public, you
> > > > force the derived class to be placed in the package?
> > >
> > > If I understand correctly, a protected method can be used by any
> > > subclass, regardless of the package. Whereas the default access
> > > means that only subclasses in the same package can use those
> > > methods.
> > >
> >
> > That's right. But above, it says default or protected access for both
> > *class* and methods - implying the subclass is of the same package?
>
> Classes cannot be protected, so default access only applies to class
> themselves. Protected access should be preferred to default for
> methods, since protected methods are also available to other classes
> in the same package (not just to subclasses, as is often assumed).
>
> Does this clarify things?
The point I am focusing on is that the classes should be public if you
want people to extend them and *not* have to put their code in the same
package. Isn't that right?
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]