dblack / candle.superlink.net wrote:
> Your second sentence doesn't necessarily relate to your initial
> question :-) Meaning: whether instance vars are private or not,
> there's no reason to think that every instance var is going to have
> one of these:

>   def var
>     @var
>   end

> associated with it.  All sorts of other permutations are
> possible... including no accessor method.

Hi David,

Totally agree.  However, the intent of making all instance variables
private is that when a child class writes '@var', it is a variable that
belongs to that specific child class so that a child class will never
accidentally overwrites a variable belonging to its parent.  A child is
never supposed to know its parent's business; a child is given access only
through its parent's methods (which may or may not represent a
simple/direct access to the parent's instance variables with similar
names).

In the case that a child really needs access to its parent's '@var' but
the parent does not provide any method to access it, then the parent class
definition can be reopened to provide 'def var; @var; end'.  So a child
always accesses its parent's data using 'self.var' (or other
'self.something') but never '@var'.

Regards,

Bill