From: Akbar Pasha Date: 2006-05-04T22:49:13+09:00 Subject: A question about attr_reader ------=_Part_7607_16241190.1146750548880 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi All, I am just going through the pickacxe book and have a question about attr_reader. Here is the sample class. class Song def initialize(name, artist, duration) @name =3D name @artist =3D artist @duration =3D duration end end It says I can do the following- class Song def name @name end def artist @artist end def duration @duration end end OR I can do the following- class Song attr_reader :name, :artist, :duration end This is fine, but it says "The corresponding instance variables, @name, @artist, and @duration, will be created automatically" (on Page 31) about attr_reader. I kinda thought that those variables are already created when "initialize" function is called. If I comment the initialize function and run it - I get an error. So what does the author mean by that? Thanks in advance, ::akbar ------=_Part_7607_16241190.1146750548880--