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-Thread: a07f3367d7,bfcbd34f9610fd42 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Ada classwide copy vs C++ clone Followup-To: comp.lang.ada Date: Thu, 07 Jul 2011 16:55:31 +0200 Organization: A noiseless patient Spider Message-ID: References: <185c1b11-6de8-49bf-9d77-8b4855cf2e76@v10g2000yqn.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Date: Thu, 7 Jul 2011 14:55:34 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="M7rP6jhm1IVgvmYaXQFuIA"; logging-data="12410"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193r+WNpognZbVLagvqapMB" User-Agent: KNode/4.4.10 Cancel-Lock: sha1:bwbKe5ggtqYKzX7R7jBqtFHZaMw= Xref: g2news1.google.com comp.lang.ada:20120 Date: 2011-07-07T16:55:31+02:00 List-Id: Maciej Sobczak wrote: > On Jul 6, 6:30 pm, "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. Thanks for the confirmation, I'll try to think of alternatives. > 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. I'm already doing this, but good reminder. Alex. > > -- > Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com