Copy constructor not being called
<p>I have a class which allocates memory on the heap and then the destructor frees it. My copy constructor is never being called for some reason and I do not understand why. Here is my implementation:</p>

<pre><code> AguiBitmap::AguiBitmap( const AguiBitmap &amp;bmp )
    {

        this-&gt;nativeBitmapPtr = al_clone_bitmap(bmp.nativeBitmapPtr);
    }

    AguiBitmap::AguiBitmap( char *filename )
    {

        if(!filename)
        {
            nativeBitmapPtr = 0;
            return;
        }

        nativeBitmapPtr = al_load_bitmap(filename);

        if(nativeBitmapPtr)
        {

            width = al_get_bitmap_width(nativeBitmapPtr);
            height = al_get_bitmap_height(nativeBitmapPtr);
        }
        else
        {
            width = 0;
            height = 0;
        }
    }




    ALLEGRO_BITMAP* AguiBitmap::getBitmap() const
    {
        return nativeBitmapPtr;
    }
</code></pre>

<p>However,
When I do something like:</p>

<pre><code>AguiBitmap bitmap;
bitmap = AguiBitmap("somepath");
</code></pre>

<p>The copy constructor code is never called (set a breakpoint). And therefore, my issue of having an invalid pointer in the reconstructed object from the temporary object becomes invalid when the temporary one is destroyed.</p>

<p>What do I do to get my copy constructor to be called?</p>

<p>Thanks</p>
