[Newbies] class variable vs class instance variable uses
Miguel Enrique Cobá Martinez
miguel.coba at gmail.com
Tue Aug 4 18:31:41 UTC 2009
El mar, 04-08-2009 a las 18:46 +0200, Bert Freudenberg escribió:
> 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.
Woa, thanks Bert and Hernán, that was a really clear explanation. Now I
understand the issues here.
> - Bert -
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners