From: Brian Candler Date: 2010-08-09T22:43:28+09:00 Subject: Re: Attributes in class Amir Ebrahimifard wrote: > Hi > Please help someone that knows C++ , and my question : > Does "attribute" in ruby is same as "private member" in c++ ? if no > please exactly explain me what is the concept of "attribute" in ruby? You're perhaps thinking of accessor methods. The following code: class Foo attr_accessor :bar end does effectively the same as this: class Foo def bar @bar end def bar=(val) @bar = val end end For learning about the basics of Ruby, I strongly recommend the book Programming Ruby. The first edition is available to view online for free: http://www.ruby-doc.org/docs/ProgrammingRuby/ Since you're already a programmer you should find this very accessible. HTH, Brian. -- Posted via http://www.ruby-forum.com/.