[squeak-dev] Re: Instance variable access in superclasses.
nicolas cellier
ncellier at ifrance.com
Wed Nov 26 20:13:49 UTC 2008
James Foster a écrit :
>
> 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
>
>
Beware, you're dangerously sliping to multiple inheritance because your
Square might also be a lozenge :)
Nicolas
More information about the Squeak-dev
mailing list
|