Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!pyrltd!tetrauk!simons From: simons@tetrauk.UUCP (Simon Shaw) Newsgroups: comp.lang.eiffel Subject: Re: Inheritance and Information Hiding Message-ID: <1101@tetrauk.UUCP> Date: 18 Feb 91 12:57:59 GMT References: <4810@mindlink.UUCP> Reply-To: simons@tetrauk.UUCP (Simon Shaw) Organization: Tetra Ltd., Maidenhead, UK Lines: 40 In article <4810@mindlink.UUCP> Bruce_Atherton@mindlink.UUCP (Bruce Atherton) writes: >I have some thoughts to add on this debate regarding how to deal with a >RECTANGLE and the add_vertex call. >... > The correct action would be to report an error. > >Bertrand Meyer pointed out that this would alter the terms of the contract, but >I don't think this is necessarily correct. It could be a fundamental part of >the language that a contract can be breached (to continue the metaphor). The >action taken when an object is in breach of contract is up to the object that >is contracting the services. > > ... It is often required that a subclass eliminate >a property of the more general class. I have been lurking here for some time, and am very keen that a satisfactory answer should be found to the inheritance debate. The above seems to me to hit the central idea of the discussion, i.e. 1. Inheritance is about specialisation. 2. Specialisation is often a _restriction_ of the range of allowed circumstances. 3. Ergo, not all the features of a parent class can necessarily be implemented on a child object. The strongest refutation of this line of argument seems to be the one which says "If this problem happens, you have got your class design wrong", (e.g. the solution of FIXED_POLYGON v. VARIABLE_POLYGON) and the subsequent discussion concentrated on how to find the error (assertions, static checks). But - can a change in class design be _proved_ to be possible in all cases, (or proved to be impossible in any case, which is the same thing). If I've missed something important, flame away ! -- Simon Shaw ; simons@tetrauk.uucp ; net.lurker