[squeak-dev] Class variables

Wolfgang Eder edw at generalmagic.at
Mon Jul 14 14:39:36 UTC 2008


Martin Beck wrote:
> Hi list,
> 
> can anyone please explain the difference between class variables at the
> instance side in the class browser and instance variables at the class
> side (thus of the metaclass) to me? And which of them is the preferred one?
> 
> Regards,
> Martin
> 
> 
hi martin,
it makes a difference if you consider subclasses:
a class variable is there only once, like a global
variable, and accessable to the class and all its subclasses.

a class instance variable is there for the class and
each of its subclasses, and can have a different value
for each subclass.

i hope that makes sense
cheers,
wolfgang



More information about the Squeak-dev mailing list