Xref: utzoo comp.lang.eiffel:1378 comp.object:2515 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!wuarchive!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!ucsd!hub.ucsb.edu!eiffel!bertrand From: bertrand@eiffel.UUCP (Bertrand Meyer) Newsgroups: comp.lang.eiffel,comp.object Subject: Re: Inheritance and Information Hiding Message-ID: <496@eiffel.UUCP> Date: 6 Feb 91 18:27:03 GMT References: <488@eiffel.UUCP> <27A86309.281A@tct.uucp> <1991Feb5.130359.9735@bellcore.bellcore.com> Organization: Interactive Software Engineering, Santa Barbara CA Lines: 28 From <1991Feb5.130359.9735@bellcore.bellcore.com> by caseau@maya.bellcore.com (Yves J Caseau): > 2. My solution to the POLYGON/RECTANGLE problem. > > I tend to be simple minded: > a. a RECTANGLE is a POLYGON (thefore there must be inheritance) > b. Adding a vertex to a polygon produces ANOTHER polygon (a different > mathematical object) > c. Thus, rectangle inherit the property add_vertex, which produces > a pentagone from a rectangle > > Don't flame me on this, I know this is cheating ... but it makes a lot of > sense. If one transposes the problem to applicative (rather than imperative) programming, where there are no procedures but only functions which do not produce side-effects, and also removes reference assignment (which introduces aliasing), this solution indeed works. Mirandeiffel? -- -- Bertrand Meyer bertrand@eiffel.com