saving . . . saved Copy Constructor has been deleted. Copy Constructor has been hidden .
Copy Constructor
What is the main role of Copy Constructor in the concept of constructor and is it save the memory for system?

Advanced-Cpp Constructor-And-Destructor 00-01 min 50-60 sec 10-04-20, 2:40 p.m. Mann_19


Dear Mann_19,

A copy constructor is used for creating a new object from an existing one, without explicitly copying each member variables. It is not meant for saving memory, but it is just a matter of neat copying provided by c++.


19-04-20, 11:17 p.m. nags

A copy constructor is a member function which initializes an object using another object of the same class. A copy constructor is called whenever a new variable is created from an object.

A copy constructor has the following general function prototype:

ClassName (const ClassName &old_obj); 

04-05-20, 11:20 p.m. Nityasree

Log-in to answer to this question.