comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca>
Subject: Re: Cloning a Class Wide Data Type with "new"?
Date: Fri, 06 Jun 2003 13:15:32 -0400
Date: 2003-06-06T13:15:32-04:00	[thread overview]
Message-ID: <3EE0CC34.70508@cogeco.ca> (raw)
In-Reply-To: 01cqbb.q3o.ln@skymaster

Jean-Pierre Rosen wrote:
> "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);

BZZZzzt!

gcc -c -gnata -gnatf -gnato tprog.adb
tprog.adb:26:50: expected type "Base_Type'Class" defined at line 6
tprog.adb:26:50: found type "Derived_Type" defined at line 14
gnatmake: "tprog.adb" compilation error

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

You do understand what I am trying to do, right?  I just cannot
seem to figure out how to specify it.

-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg




  reply	other threads:[~2003-06-06 17:15 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
2003-06-06 17:15   ` Warren W. Gay VE3WWG [this message]
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