Copy constructor vs assignment operator in C++
Difficulty Level: Rookie
Consider the following C++ program.
Assignment operator called
Copy constructor called
Copy constructor is called when a new object is created from an existing object, as a copy of the existing object (see this G-Fact). And assignment operator is called when an already initialized object is assigned a new value from another existing object.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.