a class variable is unique for a class object
a instance variable is unique for an instance of a class

class A
  @@uniq_for_class ## all instance see one variable
  @one_per_instance ## each instance hold one variable
end

hope this help!

(in C++, this is same difference between static methods and other)

On Fri, 06 Dec 2002 21:54:59 +0900, Francois GORET wrote:

> Hi,
> 
> I try to understand the difference between 'class variables' and 'class 
> instance variables', following a post by Guy Decoux a few days ago.
> 
> class A
>   @x = 12     # (class instance) variable
> 
>   def A.test
>      puts @x
>   end
> 
>   def instance_method
>      puts @@x   # does not work, I'm sad ;-)
>   end
> end
> 
>  A.new.instance_method
> => NameError: uninitialized class variable @@x in A
> 
> I understand that @@x refers only to a (non existant) class variable of A. I 
> don't catch why there is a distinction between a class instance variable and 
> a class variable: the two are "stored" in the unique object representing the 
> class A, no ? 
> 
> Is there a way to access the x variable from an instance of A ?
> 
> Francois