From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,103b407e8b68350b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-29 13:34:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!sccrnsc03.POSTED!not-for-mail From: Mark Biggar User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Anybody in US using ADA ? One silly idea.. References: <1043339266.922562@master.nyc.kbcfp.com> <7iLY9.2401$qb1.464@nwrddc01.gnilink.net> <1043680098.61106@master.nyc.kbcfp.com> <3afc3v4uur2kvd53v4ul18b5npjfm188o3@4ax.com> <1043773909.385612@master.nyc.kbcfp.com> <1043855067.848326@master.nyc.kbcfp.com> In-Reply-To: <1043855067.848326@master.nyc.kbcfp.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <3OXZ9.85359$Ve4.6306@sccrnsc03> NNTP-Posting-Host: 12.235.88.213 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc03 1043876095 12.235.88.213 (Wed, 29 Jan 2003 21:34:55 GMT) NNTP-Posting-Date: Wed, 29 Jan 2003 21:34:55 GMT Organization: AT&T Broadband Date: Wed, 29 Jan 2003 21:34:55 GMT Xref: archiver1.google.com comp.lang.ada:33581 Date: 2003-01-29T21:34:55+00:00 List-Id: Hyman Rosen wrote: > Dmitry A. Kazakov wrote: > >> That's the whole point. We want to inherit from Ellipse (non-abstract) >> some of its methods, but we do not want to inherit the representation >> (two doubles). > > > I don't understand what you are trying to accomplish. > If you want to inherit method implementation, how can > this not be tied to object representation? > What is going on here is the fundamential paradox of OO systems. It often happens that the direction of substutibility inheritence and implementation inheritence are opposite to each other. For example, you would normally like class Integer to be a subclass of class Float because you want to be able to use an Integer anywhere you can use a Float. But, given methods in class Float like Get_Exponent you want to implement class Float using Class Integer. Oops, you can't do both. In general there are four ways two classes can be related to each other in an OO system. I. class A isa class B you can use a A anywhere you can use an B In Ada terms this is "type A is new B ..." II. class A is implemented as class B each instance of class A is implemeted under the covers as an instance of class B, but you have provided a completely different interface. E.G., class Stack is implemented using class Array, but you access it via push and pop instead of indexing. type A is private; private type A is new B ...; III. class A contains class B. Class A has a visible member of type class B plus some other stuff. type A is record B_mem: B; ... end record; 1V. class A is not related ot class B at all. included of completeness. Unfortunately I and II can be in conflict like Integer and Float above and you end up wiht an unresolvable circular dependency and so must give up one or the other. -- Mark Biggar mark.a.biggar@attbi.com