(Sorry for the top posting.)

I'd like to take a shot at answering Lionel's original question (what is the 
difference between class and instance variables).  It seems convenient to use 
the result of Guy Decoux's example as an example.

If you use class and instance variables "properly", you can achieve the 
following result, which can be very useful in some cases.  Note that instance 
variables in the dog and cat class count the dogs and cats respectively, 
while the class variable (in the animal class) counts the animals (i.e., dogs 
+ cats):

0 cats, 0 dogs, 0 animals
a new dog
a new dog
0 cats, 2 dogs, 2 animals
a new cat
a new cat
a new cat
3 cats, 2 dogs, 5 animals

I am a newbie to Ruby, my answer is based on what I understand should happen 
with instance and class variables.

regards,
Randy Kramer

On Tuesday 15 March 2005 08:58 am, ts wrote:
> 0 cats, 0 dogs, 0 animals
> a new dog
> a new dog
> 0 cats, 2 dogs, 0 animals
> a new cat
> a new cat
> a new cat
> 3 cats, 2 dogs, 0 animals