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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,bfcbd34f9610fd42 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!v10g2000yqn.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada classwide copy vs C++ clone Date: Wed, 6 Jul 2011 14:00:17 -0700 (PDT) Organization: http://groups.google.com Message-ID: <185c1b11-6de8-49bf-9d77-8b4855cf2e76@v10g2000yqn.googlegroups.com> References: NNTP-Posting-Host: 83.3.40.82 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1309986017 30998 127.0.0.1 (6 Jul 2011 21:00:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 6 Jul 2011 21:00:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v10g2000yqn.googlegroups.com; posting-host=83.3.40.82; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20107 Date: 2011-07-06T14:00:17-07:00 List-Id: On Jul 6, 6:30=A0pm, "Alex R. Mosteo" wrote: > More reading late, my current conclusion is that I need to use the Clone > pattern and implement a cloning method in every derived class. > > So, this is what I'd like to hear confirmed. Am I right? Yes. This is also why you should *carefully* rethink the requirement for having this operation in the whole hierarchy. It should not come up by default. Also, you will want to use boost::shared_ptr or something similar to protect yourself from the pointer mess. Raw pointers are to be avoided, even if pointer-related patterns have to be used. -- Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com