What's the difference in scope for these two variables: @name and @@name?
Answer Posted / Ravi Tewari
In Ruby, @name is an instance variable which belongs to a specific object instance. It has a different value for each object of the same class. On the other hand, @@name is a class variable, it is shared among all instances of the class, and it has the same value for every object of that particular class.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers