Re: Clean Object Class Design -- Circle/Ellipse
Date: Fri, 31 Aug 2001 22:19:55 -0400
Message-ID: <XAXj7.614$ej4.124433560_at_radon.golden.net>
Jan Hidders wrote in message <9md9em$gdi$1_at_news.tue.nl>...
>Bob Badour wrote:
>> Jan Hidders wrote in message <9mc0km$6n0$1_at_news.tue.nl>...
>> >
>> >Sure, sounds a bit tautological doesn't it. :-) But to get back to the
>> >point, it is simply not true that LSP requires that
>> >
>> > CircleVar := Ellipse(...)
>> >
>> >should work. What should work is
>> >
>> > EllipseVar := Ellipse(...)
>> >
>> >but LSP does not say that you may replace EllipseVar with CircleVar
>> >because the type of CircleVar is not a subtype of EllipseVar. That
>> >is because the type of CircleVar is not Circle but something like
>> >REF(Circle), i.e., a *reference* to a circle, (or, as Bob would say,
>> >a *variable* of type Circle) and it is not necessarily true that
>> >REF(Circle) is a subtype of REF(Ellipse). In fact it is exactly the
>> >other way around; REF(Ellipse) is a subtype of REF(Circle).
>> >
>> >Which is what Date has been saying all along. :-)
>>
>> I am not sure whether I understand the statement that REF(Ellipse) is
>> a subtype of REF(Circle).
>>
>> I do not see how ellipse reference values are a subset of circle
>> reference values and I do not see how ellipse reference operations
>> are either a superset or subset of circle reference operations.
>
>Note that reference values are in fact variables. Since every Ellipse
>variable can play the role of a Circle variable, the Ellipse variables
>are a subset of the Circle variables. As far as the operations go, they
>both have the same two operations: assignment and dereference. So by
>Date's definition the type 'Ellipse variable' is a subtype of 'Circle
>variable'.
Egad, you are right! Give the man a beer! I know I need one.
>--
> Jan Hidders
>
>PS. Thanks for the quote attribution.
You are welcome. I had not considered how deleting them could inconvenience someone trying to follow the flow. Received on Sat Sep 01 2001 - 04:19:55 CEST
