From: 7stud -- Date: 2008-04-30T15:44:25+09:00 Subject: Re: What is attr_accessor? tenxian wrote: > I even don't know what attr_accessor is. class Dog def initialize(a_name) @name = a_name end def name #get the name return @name end def name=(a_name) #set the name @name = a_name end end d = Dog.new("Spot") puts d.name #Spot d.name = "Red" puts d.name #Red ======compare to: ============ class Dog attr_accessor :name def initialize(a_name) @name = a_name end end d = Dog.new("Spot") puts d.name #Spot d.name = "Red" puts d.name #Red -- Posted via http://www.ruby-forum.com/.