Thursday, 5 September 2013

Why do we put & in copy constructor?

Why do we put & in copy constructor?

I am a c++ newbie and i want to know that why do we need to put & in the
copy constructor in c++ class.I understand that using ampersand provides
the reference of the object to be copied and a new copy of the object is
not created.But why am i not allowed to copy the object (ignoring the
memory usage point)?

No comments:

Post a Comment