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-7-bit X-Google-Thread: 103376,741d9c75087d538f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-06 16:05:38 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: anh_vo@udlp.com (Anh_Vo) Newsgroups: comp.lang.ada Subject: Re: Cloning a Class Wide Data Type with "new"? Date: 6 Jun 2003 16:05:37 -0700 Organization: http://groups.google.com/ Message-ID: <5a59d6a9.0306061505.72b5f19d@posting.google.com> References: <3EE097D5.2010901@cogeco.ca> <5a59d6a9.0306061038.18a1072@posting.google.com> NNTP-Posting-Host: 65.168.133.148 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1054940738 13361 127.0.0.1 (6 Jun 2003 23:05:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 6 Jun 2003 23:05:38 GMT Xref: archiver1.google.com comp.lang.ada:38775 Date: 2003-06-06T23:05:38+00:00 List-Id: > Base_Class is not a real type. Base_Type and Derived_Type are real > types. Thefore, either one of them should be used. I assume > Derived_Type was your intention in this case. Otherwise, explicit > conversion is needed. Both cases are shown below. > > Cloned : Base_Access := new Derived_Type' (Orig); -- case 1 > > Cloned : Base_Access := new Base_Type' (Base_Type (Orig)); -- case 2 > > A. Vo My fingers were ahead of my thought. What I mean was that Base_Class is class wide type while Base_Type and Derived_Type are not. That means there should be case 3 for it. Cloned : Base_Access := new Base_Class' (Base_Class (Orig)); -- case 3 By the way, I made another error while typing the word Therefore. But it turned out to be Thefore.