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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,741d9c75087d538f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-06 10:30:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!torn!snoopy.risq.qc.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Message-ID: <3EE0CC34.70508@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Cloning a Class Wide Data Type with "new"? References: <3EE097D5.2010901@cogeco.ca> <01cqbb.q3o.ln@skymaster> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Date: Fri, 06 Jun 2003 13:15:32 -0400 NNTP-Posting-Host: 198.96.223.163 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1054919732 198.96.223.163 (Fri, 06 Jun 2003 13:15:32 EDT) NNTP-Posting-Date: Fri, 06 Jun 2003 13:15:32 EDT Organization: Bell Sympatico Xref: archiver1.google.com comp.lang.ada:38764 Date: 2003-06-06T13:15:32-04:00 List-Id: Jean-Pierre Rosen wrote: > "Warren W. Gay VE3WWG" 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