Xref: utzoo comp.lang.eiffel:1372 comp.object:2502 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!lll-winken!unixhub!pfkeb From: pfkeb@ebnextk.SLAC.Stanford.EDU (Paul Kunz) Newsgroups: comp.lang.eiffel,comp.object Subject: Re: Inheritance and Information Hiding Message-ID: Date: 5 Feb 91 05:24:28 GMT References: <488@eiffel.UUCP> <27A86309.281A@tct.uucp> <1991Feb1.135956.12425@tukki.jyu.fi> <27ADD06B.46A3@tct.uucp> Sender: news@unixhub.SLAC.Stanford.EDU Followup-To: comp.lang.eiffel Organization: Stanford Linear Accelerator Center Lines: 34 Nntp-Posting-Host: ebnextk.slac.stanford.edu In-reply-to: chip@tct.uucp's message of 4 Feb 91 21:21:46 GMT In article <27ADD06B.46A3@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: I now agree, however, with those who suggest that RECTANGLE is not an appropriate derivation of POLYGON. There is an assumption built into a POLYGON interface that includes an add_vertex() function: that a POLYGON may be modified in its number of vertices. The derivation of RECTANGLE from POLYGON violates that assumption. Separate inheritance subtrees of POLYGON, such as FIXED_POLYGON and VARIABLE_POLYGON, now seem to me the best way to go. -- Chip Salzenberg at Teltronics/TCT , "Most of my code is written by myself. That is why so little gets done." -- Herman "HLLs will never fly" Rubin I've been following this thread a few days but have not had time to respond but have come to the same conclusion. If POLYGON is going to be SuperClass of RECTANGLE (and TRIANGLE and SQUARE) then it can not possibly have a add_vertex() function. This is the error. Only a very specialized class of VARIABLE_POLYGON which inherits from POLYGON can have such a method. In my mind the confusion comes from the fact that a RECTANGLE (or TRIANGLE or SQUARE) is something real that we can see, feel, and touch. They all inherit from something generic, not real, not touchable. On the other hand, a n-point POLYGON is also real that can be changed to n+1 points. It inherits from something generic as well. The mistake is to call this generic thingy a POLYGON and put a add_vertex function in it. That's my two cents.