Max Ischenko <max / malva.com.ua> writes:

> > own  set of  variables,  that  aren't touched  by  subclasses. That  isn't
> So, this is a feature? It seems counter-intuitive.
> 
> Here is excerpt for Dave Tomas' book:
> Class Variables
> 
> A class  variable is shared  among all  objects of a  class, and it  is also
> accessible to the class methods that we'll describe later. There is only one
> copy of a particular class variable  for a given class. Class variable names
> start with two ``at'' signs, such as ``@@count''. Unlike global and instance
> variables, class variables  must be initialized before they  are used. Often
> this initialization  is just a  simple assignment in  the body of  the class
> definition.
> 
> It says 'one copy for a given class' not for `class hieararchy'.

I agree: we don't really say either way in the book. To make it
clearer that Ruby classes inherit class variables, I'll add some
wording to page 214 at the next printing.


Dave