comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Polymorphism question
Date: 1997/02/23
Date: 1997-02-23T00:00:00+00:00	[thread overview]
Message-ID: <dewar.856702823@merv> (raw)
In-Reply-To: b6afovlqrs.fsf@volkov.i-have-a-misconfigured-system-so-shoot-me


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!





  reply	other threads:[~1997-02-23  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-20  0:00 Polymorphism question Robert Oeckl
1997-02-20  0:00 ` Samuel Mize
1997-02-23  0:00 ` Kirk Beitz
1997-02-23  0:00   ` Robert Dewar [this message]
1997-02-23  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox