Newbie Question - Instance Variables

goran.krampe at bluefish.se goran.krampe at bluefish.se
Thu Feb 5 11:44:07 UTC 2004


"Ed Grant" <CEO at EdGrant.com> wrote:
> I need some help.
> 
> What happens in this scenario?
> 
>     1. I create a new class (with few instance variables & methods).
> 
>     2. I creating several instances.
> 
>     3. I decide I need to add another instance variable to the new class.
> 
> Question: Can I add the new instance variable to the new class without
> causing any problems?

Yes. :)

> If I can, will that new instance variable be duplicated in all the instances
> that were previously created? What will each new instance object contain in
> the new instance variable.

Yes. It will contain nil.
 
This is a cornerstone in Smalltalk - object migration. Otherwise it
would be very hard to change the system.

regards, Göran



More information about the Squeak-dev mailing list