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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5ea4e8c5a1c5a499 X-Google-Attributes: gid103376,public From: Kirk Beitz Subject: Re: Polymorphism question Date: 1997/02/23 Message-ID: #1/1 X-Deja-AN: 220834807 Sender: beitz@volkov References: <330C9CB8.41C6@pheno.physics.wisc.edu> Original-Sender: beitz@volkov.nosc.mil Organization: Booz*Allen & Hamilton, Inc. Reply-To: johndoe@world.std.com Newsgroups: comp.lang.ada Date: 1997-02-23T00:00:00+00:00 List-Id: Robert Oeckl writes: > > I have problems to figure out, how Polymorphism works in Ada. I want to > know if and how the following is possible in Ada: > > Suppose I have an abstact type A. Now I have two (non-abstract) > descendants B and C of A. Furthermore there is a descendant D of C. For > A an abstract procedure P1 is defined and for B and C P1 is overloaded. > > I do also want to be able to call P1 with type D without explicitly > defining P1 for D, so that the procedure as defined for type C is > executed with type D. well, you are out of luck. you must define P1 for type D separately. that is the nature of the abstract definition of P1. > Now I have a procedure P2 defined for type C. For type D I want to > overload this procedure. But in the overloaded procedure I want make a > call to P2 as defined for C, if possible without loosing the information > that the object is actually of type D inside the called procedure. actually, those of us whom english is a first language use the word "losing" to describe what you're talking about. but other than that, i don't see what it is you're trying to solve.