Wednesday, 1 October 2008

C++ ocean - Part 1

I am trying to understand what the following means! (It's 11 at night and I am not fresh.)

[ Courtesy: http://www.fredosaurus.com/notes-cpp/oop-condestructors/copyconstructors.html ]

Difference between copy constructor and assignment

A copy constructor is used to initialize a newly declared variable from an existing variable. This makes a deep copy like assignment, but it is somewhat simpler:
There is no need to test to see if it is being initialized from itself.
There is no need to clean up (eg, delete) an existing value (there is none).
A reference to itself is not returned.

No comments: