From: Robert Klemme Date: 2003-06-26T00:44:46+09:00 Subject: Re: protect parents from children "Simon Strandgaard" <0bz63fz3m1qt3001@sneakemail.com> schrieb im Newsbeitrag news:pan.2003.06.25.11.28.38.783568@sneakemail.com... > On Wed, 25 Jun 2003 21:02:10 +0900, ts wrote: > > >>>>>> "S" == Simon Strandgaard <0bz63fz3m1qt3001@sneakemail.com> writes: > > > > S> Me don't understand. If I add debug-print's to selftest then I see that > > S> the parent *has* changed ?? Can you enligthen me ? > [snip] > > > > I don't see a parent nor a child : I just see an object which modify one > > of these instance variable. > > OK. I think im to c++bias'ed (assuming too much). No, it's just an OO thingy. Even in C++ there is no parent or child: just a single instance with several instance variables. The only difference between C++ and Ruby with respect to this issue are the scoping and visibility rules. But the basic principle is the same. > Is it possible to make the variable readonly to the child ? Not without complicated tricks. Typically you want to avoid outside access to instance variables but not access through child class methods. robert