Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!metro!usage.csd.unsw.oz.au!syacus!ian From: ian@syacus.acus.oz.au (Ian Joyner) Newsgroups: comp.lang.eiffel Subject: Re: Inheritance and Information Hiding Message-ID: <1991Feb25.012741.14576@syacus.acus.oz.au> Date: 25 Feb 91 01:27:41 GMT References: <1991Feb5.130359.9735@bellcore.bellcore.com> <1991Feb6.045542.791@visix.com> <1991Feb7.091114.5021@tukki.jyu.fi> Organization: ACUS Australian Centre for Unisys Software, Sydney Lines: 20 sakkinen@tukki.jyu.fi (Markku Sakkinen) writes: >In any case, in typical OOPL's (and this goes as well for C++ as for >Smalltalk and Eiffel) a Rectangle class should not inherit any kind >of _concrete_ Polygon class: the baggage would include not only You could consider a rectange as a specialised parallelogram. In this case the rectangles invariant checks the added restriction, that the rectangles angles are all 90 deg, whereas the parallelogram must only check the opposite angles are equal, and they add up to 360 deg. However, a parallelogram is a concrete class from which rectangle can inherit, as all rectangles are parallelograms. A square may multiply inherit from a rectangle and a rhombus. In this case it does not need to extend the invariant, as the essential properties of all sides being equal are inherited from rhombus, and all angles being 90 deg are inherited from rectangle. -- Ian Joyner ACSNet: ian@syacus.oz ACUS (Australian Centre for Unisys Software) DNS: ian@syacus.oz.au Tel 61-2-390 1328 Fax 61-2-390 1391 UUCP: ...uunet!munnari!syacus.oz