From: Gavin Sinclair Date: 2002-11-17T22:39:10+09:00 Subject: Re: Newbie questions regarding getter/setter methods... From: "Yohanes Santoso" > > In general, how do member variables work? Are they all private and > > require accessor/reader methods to be accessed at all? My background > > includes a little bit of C/C++ and Java. > > They are all private to outsider (not subclasses). To make them > public, you have to either attr_reader or attr_writer or attr_accessor > them. I think it's worth clarifying here: member variables are always protected. They are not "made public" by attr_* methods - because these create *methods*, not tunnels-by-which-member-variables-can-be-accessed. It's a subtle difference ... until someone redefines the 'x=' method. Gavin