------art_81133_29461043.1168892167016
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

class A
  @my_var  23
  @@my_var  34

  def A.cv
   @@my_var
  end

  def A.cval)
    @@my_var  al
  end

  class <<self
    attr_accessor :my_var
  end
end

Obviously @my_var and @@my_var are two separate entitites, but are similar
in many ways. I have some questions around them, any help is appreciated.

1. In terms of the figure in the PickAxe book 2nd Ed (page 381, lucille,
Guitar etc), where would these two variables ( @my_var and @@my_var )
appear?
2. If I have a subclass -
      class B < A
      end
 the @@my_var is shared between the parent and child but @my_var is a
separate instance in each of them. Are there any other such differences?
3. As I have written accessor for @my_var, it most likely becomes a method
in the virtual class A', is there any way to write accessor for @@my_var
using Module's attr_accessor method?
4. As a general guideline where would I use one or the other?


Thanks
Nasir

------art_81133_29461043.1168892167016--