"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?
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]