comp.lang.ada
 help / color / mirror / Atom feed
From: jsanchor@my-dejanews.com
Subject: Re: Access types
Date: 1998/05/29
Date: 1998-05-29T00:00:00+00:00	[thread overview]
Message-ID: <6kmna3$aal$1@nnrp1.dejanews.com> (raw)
In-Reply-To: EtnJAp.8E@jvdsys.nextjk.stuyts.nl


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




  reply	other threads:[~1998-05-29  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-27  0:00 Access types jsanchor
1998-05-28  0:00 ` Jerry van Dijk
1998-05-29  0:00   ` jsanchor [this message]
1998-05-30  0:00     ` Jerry van Dijk
  -- strict thread matches above, loose matches on Subject: below --
1999-07-15  0:00 Access Types Ronald Ayoub
1999-07-21  0:00 ` Robert A Duff
1999-07-22  0:00   ` Steve Folly
1999-07-23  0:00     ` Tucker Taft
2007-07-01  0:39 access types Brian May
2007-07-01  1:54 ` Robert A Duff
2007-07-01  7:52   ` Dmitry A. Kazakov
2007-07-01 14:57     ` Robert A Duff
2007-07-01 19:41       ` Dmitry A. Kazakov
2007-07-02  0:12         ` Robert A Duff
2007-07-02  8:06           ` Dmitry A. Kazakov
2007-07-02 15:37       ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox