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.3 required=5.0 tests=BAYES_00,INVALID_MSGID 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: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Polymorphism question Date: 1997/02/23 Message-ID: #1/1 X-Deja-AN: 220845284 References: <330C9CB8.41C6@pheno.physics.wisc.edu> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-02-23T00:00:00+00:00 List-Id: Robert O asks <<> 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.>> To which Kirk gave the helpful :-) answer that loosing was misspelled. But I suspect the help that Robert was looking for was how to make a call to P2! This is easily done, just convert the argument to type C, so the call looks like P2 (C (Arg)). This is a view conversion and indeed it does not lose (or loose) the information that the object is actually of type D. P.S. Kirk, it's a perfectly reasonable question. It might be easily assumed that a conversion of the D object to type C would lose the tag (i.e. that the result of the conversion would be a real C), but it is an important part of the design that such conversions are NOT real conversions in this sense, but simply provide a view of the D that looks like a C for the purpose of the call, but a subsquent dispatching call will know that it is really a D. I hope I am correctly understanding both questions here!