comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Pointers explained?
Date: Mon, 30 Jul 2007 15:20:56 -0700
Date: 2007-07-30T15:20:56-07:00	[thread overview]
Message-ID: <1185834056.927503.30620@z28g2000prd.googlegroups.com> (raw)
In-Reply-To: <1185824195.711745.136860@i13g2000prf.googlegroups.com>

On Jul 30, 12:36 pm, I wrote while half-asleep:

> A couple things I might point out: First, if you have a factory
> function [say Create_Message] that returns Message'Class (i.e. *not* a
> pointer), you can declare variables of type Message'Class as long as
> you use the function (or some other function call, maybe) as an
> initializer:
>
>     Var1 : Message'Class := Create_Message (...);
>
> When you do this, Create_Message can return any type derived from
> Message.  At that point, the program will determine how much space is
> needed for Var1 and allocate it.  Var1's type can't be changed after
> that, though; if Create_Message returns a Message_3, Var1's type will
> be fixed at Message_3, and you can't, say, assign
>
>     Var1 := Y;
>
> unless Y also happens to have type Message_3.  (If it's the wrong
> type, a Constraint_Error exception will be raised.)  This applies to
> record components also

No, it doesn't.  My bad.  Record components have to have definite
subtypes.  Sorry---I should have tried it first to make sure.

                     -- Adam




  parent reply	other threads:[~2007-07-30 22:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-30 17:53 Pointers explained? shaunpatterson
2007-07-30 17:56 ` shaunpatterson
2007-07-30 19:04   ` Ed Falis
2007-07-30 19:05   ` Ludovic Brenta
2007-07-30 19:36   ` Adam Beneschan
2007-07-30 21:23     ` Maciej Sobczak
2007-07-30 22:36       ` Adam Beneschan
2007-07-31  7:33         ` Dmitry A. Kazakov
2007-07-31  1:15       ` Anh Vo
2007-07-30 22:20     ` Adam Beneschan [this message]
2007-07-30 21:31   ` Jeffrey R. Carter
2007-07-31 17:21   ` Simon Wright
2007-07-31 18:06     ` Dmitry A. Kazakov
2007-07-31 22:38       ` shaunpatterson
2007-08-01  7:53         ` Martin Krischik
2007-08-01  8:21         ` Dmitry A. Kazakov
2007-08-10 19:52         ` Simon Wright
2007-07-30 20:11 ` Dmitry A. Kazakov
2007-07-31  8:28 ` Martin Krischik
  -- strict thread matches above, loose matches on Subject: below --
2007-07-30 17:53 shaunpatterson
replies disabled

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