From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: generic formal object of class-wide type
Date: 1999/04/29
Date: 1999-04-29T00:00:00+00:00 [thread overview]
Message-ID: <m390bbs908.fsf@mheaney.ni.net> (raw)
In-Reply-To: 7g9kga$dl1@hobbes.crc.com
"David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> writes:
> Matthew Heaney wrote in message ...
> >When I try to compile package Q (see below), I get this error:
> >
> >q.ads:3:25: type of actual does not match type of "O"
> >
> >Why?
> >
> The actual needs to be explicitly converted to the type of the
> formal, like so:
>
> package Q is new GQ (P.T'Class (P.C.O));
Yes, but why?
If I have a subprogram with a parameter of a class-wide type, like this:
procedure Op (O : T'Class);
and NT is a type in T'Class, then I can do this:
declare
O : NT;
begin
Op (O);
end;
No conversion to type T'Class is required in order to call Op.
It is inconsistent that a type conversion is required in order pass the
object as a generic actual. I'd like to know the specific rule, and a
rationale for the inconsistency.
next prev parent reply other threads:[~1999-04-29 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-29 0:00 generic formal object of class-wide type Matthew Heaney
1999-04-29 0:00 ` Jean-Pierre Rosen
1999-04-29 0:00 ` David C. Hoos, Sr.
1999-04-29 0:00 ` Matthew Heaney [this message]
1999-04-30 0:00 ` Robert A Duff
1999-04-30 0:00 ` Richard D Riehle
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox