[Seaside] Subclasses

Colin Putney cputney at wiresong.ca
Sat Jul 4 02:36:12 UTC 2009


On 3-Jul-09, at 7:21 PM, Robert Sirois wrote:

> Here's a completely noob Smalltalk question:
>
> Let's say you have a superclass ie.:
>
> WAComponent subclass: #aSuperClass
>     instanceVariableNames: 'iVar'.
>
> and a subclass of it:
>
> aSuperClass subclass: #aSubClass
>     instanceVariableNames: ''.
>
> Basic super/subclass situation with one iVar... so my question is,  
> when you instantiate an instance of the subclass, it also has iVar  
> (not static), right? Or am I totally confused? Also, if I wanted to  
> create accessors for it, would I put those on the parent or child  
> class?

That's right. Instances of your subclass will have their own values  
for iVar. In Smalltalk, a "static variable"—a single variable that's  
shared between all instances of the class (and all subclasses)—is  
called a "class variable". You can put accessors on either the  
superclass or the subclass, and as long as you only have one subclass  
it makes no difference.

Does that clarify things for you?

Colin 


More information about the seaside mailing list