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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2045dce6c7815bab,start X-Google-Attributes: gid103376,public From: kbrun@ibm.net Subject: access types and dispatching subprograms Date: 1996/06/23 Message-ID: <4qjqre$44lo@news-s01.ny.us.ibm.net>#1/1 X-Deja-AN: 161703108 reply-to: kbrun@ibm.net newsgroups: comp.lang.ada Date: 1996-06-23T00:00:00+00:00 List-Id: 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