"A" <A@iprimus.com.au> wrote in message
news:3f********@news.iprimus.com.au...
Hi,
Can someone please explain what a copy constructor does and how it's
useful? Thanks,
It constructs an object (like the regular c'tor) from an already
existing object. This way you avoid first constructing and then
assigning (ie. two steps, instead of one).
can't you use use the assignment operator to copy? that should be one step
as well.
asasas
A a;
A b(a); // copy construct, one step
A c; // default construct, step 1
c = a; // assign, step 2
Creating a copy of an object using assignment uses two steps, first the
object is constructed, then it is assigned.
john