[squeak-dev] Re: Instance variable access in superclasses.

James Foster Smalltalk at JGFoster.net
Wed Nov 26 05:42:15 UTC 2008


On Nov 25, 2008, at 7:45 PM, Igor Stasenko wrote:
> My understanding of inheritance is different, in short:
> A subclass of particular class is a _specialization_ of base class,
> not  _expansion_.

In this context, I sometimes wonder if Square should inherit from  
Rectangle (a specialization in which width and height are equal), or  
Rectangle should inherit from Square (adding an instance variable). Am  
I right that you would have Square inherits from Rectangle (Square  
being more specialized)? But then it feels like we are wasting an  
instance variable (since Rectangle would have two).

James



More information about the Squeak-dev mailing list