comp.lang.ada
 help / color / mirror / Atom feed
From: Kirk Beitz <beitz@volkov.nosc.mil>
Subject: Re: Polymorphism question
Date: 1997/02/23
Date: 1997-02-23T00:00:00+00:00	[thread overview]
Message-ID: <b6afovlqrs.fsf@volkov.i-have-a-misconfigured-system-so-shoot-me> (raw)
In-Reply-To: 330C9CB8.41C6@pheno.physics.wisc.edu


Robert Oeckl <oeckl@pheno.physics.wisc.edu> 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.






  parent 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 [this message]
1997-02-23  0:00   ` Robert Dewar
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