From: Joost Diepenmaat Date: 2006-06-01T03:49:41+09:00 Subject: Re: OO / Private verse Protected 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.