comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean-Pierre Rosen" <rosen@adalog.fr>
Subject: Re: Cloning a Class Wide Data Type with "new"?
Date: Fri, 6 Jun 2003 17:34:30 +0200
Date: 2003-06-06T17:34:30+02:00	[thread overview]
Message-ID: <01cqbb.q3o.ln@skymaster> (raw)
In-Reply-To: 3EE097D5.2010901@cogeco.ca

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 882 bytes --]


"Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca> a �crit dans le message news:
3EE097D5.2010901@cogeco.ca...
> I havn't had much time to research this one yet, but I've
> got stuck trying to clone a class wide type this morning,
> on my way to work. A sample program is provided below.
>
> I need to be able to allocate and then copy an arbitrary
> tagged type (based upon a base type) into the newly
> allocated object. There's gotta be a way to do this..
> I just can't remember it!
>
> The problem is the operation of the form of :
>
>    Cloned : Base_Access := new Base_Class'(Orig);
>

   Cloned : Base_Access := new Base_Class'class'(Orig);

Hey, in Ada types must conform, and Base_Access is an access to
Base_Access'Class!

--
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





  reply	other threads:[~2003-06-06 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-06 13:32 Cloning a Class Wide Data Type with "new"? Warren W. Gay VE3WWG
2003-06-06 15:34 ` Jean-Pierre Rosen [this message]
2003-06-06 17:15   ` Warren W. Gay VE3WWG
2003-06-06 18:11 ` David C. Hoos
2003-06-06 18:18 ` Marc A. Criley
2003-06-06 18:38 ` Anh_Vo
2003-06-06 23:05   ` Anh_Vo
2003-06-09 16:48     ` Warren W. Gay VE3WWG
replies disabled

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