From: kbrun@ibm.net
Subject: access types and dispatching subprograms
Date: 1996/06/23
Date: 1996-06-23T00:00:00+00:00 [thread overview]
Message-ID: <4qjqre$44lo@news-s01.ny.us.ibm.net> (raw)
I have some trouble with Ada95 dispatching subprograms and access types.
AFAIK, a proc. call should dispatch if all corresponding actual parameters
are of (*or pointing to*) type T'Class and if the formal parameters are
of (*or pointing to*) type T. Still, the following code sample doesn't
work.
--
package T is
type T is tagged null record;
type T_p is access all T;
type TC_p is access all T'class;
type T1 is new T with null record;
type T1_p is access all T1;
procedure disp(p: T_p);
procedure disp(p: T1_p);
procedure do_dispatch;
end T;
package body T is
procedure disp(p: T_p) is
begin
Put("T_p");
end disp;
procedure disp(p: T1_p) is
begin
Put("T1_p");
end disp;
procedure do_dispatch is
classp: TC_p := new T1;
begin
disp(classp); -- this call won't dispatch, instead it causes
-- a compiler error. what's wrong?
end do_dispatch;
end x;
--
Could someone please enlighten me on this subject?
-- Klaus A. Brunner Austria, Europe
-- mailto:kbrun@ibm.net
next reply other threads:[~1996-06-23 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-06-23 0:00 kbrun [this message]
1996-06-23 0:00 ` access types and dispatching subprograms Robert A Duff
1996-06-23 0:00 ` Robert Dewar
1996-06-25 0:00 ` Samuel Tardieu
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox