At least in Java these modifiers are quite usefull: a protected method
is one that offers extensibility/polymorphic behavior for hierarchies,
without exposing it as public API. So the behavior may vary according
to the implementation, and the exposed API/public methods are a
completely different thing.

./alex
--
.w( the_mindstorm )p.


On 5/31/06, Joost Diepenmaat <joost / zeekat.nl> wrote:
> On Thu, Jun 01, 2006 at 03:35:19AM +0900, Paul D. Kraus wrote:
> > Can someone give me an example of when a private method would be more
> > appropaiate then a protected one?
> >
> > I understand the definition of the two but I don't quit understand the uses.
> >
> > A protected method is only accessible from other objects derived from the
> > same class.
> > A private method is basically the same thing but can only be called by the
> > current object.
> >
> > *shrug* how are those two things different.
> > When would you ever have an instance that is going to call a method from
> > another instance?
>
> Personally, I think protected methods are completely useless, except _maybe_
> if you want to allow some "dirty" access to improve performance in very
> specific cases.
>
> If your methods are supposed to be called from other instances
> you're almost always better off making the methods public - if that makes
> your API ugly, you've usually got a bad design.
>
> Joost.
>
>
>