    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Seductive Tips</title>
        <link>https://members.accu.org/index.php/articles/938</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">Programming Topics + CVu Journal Vol 11, #6 - Oct 1999</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c65/">Programming</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c129/">116</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/c65-129/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/articles/c65+129/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Seductive Tips</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 October 1999 13:15:34 +01:00 or Sun, 03 October 1999 13:15:34 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e20" id="d0e20"></a></h2>
</div>
<p class="c2"><span class="remark">A few weeks ago the following
appeared on one of the C++ newsgroups. I want you to study it very
carefully and then itemise all the reasons why you consider this
apparently seductive idea to be extremely dangerous.</span></p>
<p><span class="bold"><b>A Not So Obvious C++ Tip:</b></span></p>
<p>Define copy assignment operator out of copy constructor
Typically copy assignment operator and copy constructor are closely
related to one another. Both of them are expected to leave an
object in a state of being a copy to another one. One can use this
fact in order to simplify the task of defining the assignment
operator out of the copy constructor, as shown below.</p>
<pre class="programlisting">
//  Define copy assignment out of copy constructor.
//  DEFINE_ASS_BY_CTOR(ClassName)
//  To appear (only) within class definition.
// Define copy assignment out of copy constructor.
#define DEFINE_ASS_BY_CTOR(ClassName)  \
ClassName &amp; operator = (const ClassName &amp; from)  \ 
{                    \
  assert (this &amp;&amp; &amp;(from));                                 \
  assert (typeid (*this) == typeid (ClassName));   \
   if (this == &amp;(from))                                      \
      return *this;                                          \
   ClassName::~ClassName();                                  \
   new (this) ClassName (from);                              \
   return *this;                                               \
   }
</pre></div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
