From: dblack@... Date: 2006-02-28T05:04:55+09:00 Subject: Re: Confused about "private"?? Hi -- On Tue, 28 Feb 2006, John N. Alegre wrote: > > I have a confusion in Ruby's way of dealing with "private" instance methods. > > "Private" means that the method is accessible only within the class, and it > is callable only in "function form," with self (implicit or explicit) as a > receiver." "Protected" gives access to the method in subclasses. Private methods cannot be called with an explicit receiver, and "self" is an explicit receiver. The only exception is "setter" methods (ending with an equal sign), where you need an explicit receiver so that it isn't taken for assignment to a variable. There was a long thread about this in the past week or so -- have a look. > What am I missing? This is not to the best of my knowledge the way things > are in Java. Why would it be? :-) David -- David A. Black (dblack@wobblini.net) Ruby Power and Light (http://www.rubypowerandlight.com) "Ruby for Rails" chapters now available from Manning Early Access Program! http://www.manning.com/books/black