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?
···
--
Posted via http://www.ruby-forum.com/.
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?
--
Posted via http://www.ruby-forum.com/.
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?
i thing you are talking about rails model
attribute is a instance variable of that class
--
Posted via http://www.ruby-forum.com/\.
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/\.