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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,491f04bc76bcfb52 X-Google-Attributes: gid103376,public From: jsanchor@my-dejanews.com Subject: Re: Access types Date: 1998/05/29 Message-ID: <6kmna3$aal$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 357601465 References: <6khbm1$ec1$1@nnrp1.dejanews.com> X-Http-User-Agent: Mozilla/4.04 [en] (X11; U; SunOS 5.5.1 sun4u) Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Fri May 29 16:21:24 1998 GMT Newsgroups: comp.lang.ada Date: 1998-05-29T00:00:00+00:00 List-Id: Well, it's tip of the ice berg. Package Memory has a subprogram procedure Checksum(access_to_ram : access Memory_Type'class);-- primitive -- operation RAM is declared in another package. And somebody trying to use checksum will say something like this: package RAMS is type RAM_Type is new Memory.Memory_Type with null record; RAM: aliased RAM_Type; Memory.Checksum(RAM'access); end RAMS; Now my problem is: I want RAM'access to be the same type as Memory_Ptr because of the nature of my program. But I just can't do it. I tried casting it, like this Ptr_to_memory : Memory_Ptr; Ptr_to_memory : Memory_Ptr(access_to_ram); it compiled, but does not run. Gives me a run time error....PROGRAM_ERROR. -------------------------------------------------------------------- > What you seem to mean is something like: > > package Memory is > > type Memory_Type is abstract tagged > record > null; -- Put the data here > end record; > > type Memory_Ptr is access Memory_Type'Class; > > type ROM is new Memory_Type with null record; > > type RAM is new Memory_Type with null record; > > end Memory; > > -- > -- Jerry van Dijk | email: jdijk@acm.org > -- Leiden, Holland | member Team-Ada > -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading