[Newbies] class variable vs class instance variable uses

Bert Freudenberg bert at freudenbergs.de
Tue Aug 4 16:46:14 UTC 2009

On 04.08.2009, at 17:28, Miguel Enrique Cobá Martinez wrote:

> What is the difference between a class variable like Current in  
> Locale class:

A class variable exists once per image. A class instance variable  
exists once per subclass.

If your singleton class has no subclasses, it doesn't matter. If it  
has subclasses, then each subclass will have a different singleton if  
you use a class instance variable. With a class variable, you only  
have one singleton for all subclasses.

- Bert -

More information about the Beginners mailing list