differences between C + + copy constructors and evaluators:http://blog.csdn.net/randyjiawenjie/article/details/6666937
copy constructor and assignment function :http://www.cnblogs.com/dwdxdy/archive/2012/07/17/2594993.html
!!!! The above two articles speak better, it is worth to look carefully.
The difference between a copy constructor and an assignment operator
A copy constructor is also called a copy constructor, and the difference between it and the assignment operator is reflected in the following aspects
1. Conceptually distinguished: The
copy constructor is a constructor, and the assignment operator is a category of operator overloading, which is usually the member function of a class
2. Differentiate from prototype:
Copy constructor prototype ClassType (const ClassType &), no return value
Assignment operator prototype classtype& operator= (const ClassType &) ; The return value is a reference to ClassType, facilitating continuous assignment of operations
3. Differentiate from usage: The
copy constructor is used to produce the object, which is used in the following places: When the function parameter is a value type for a class, when the function returns a class type, and an initialization statement, for example, the initialization statement, the function argument and the function return value as the value type of the class, is not shown here.
ClassType A; //
ClassType B (a); //Call copy constructor
classtype C = a ; //Call the copy constructor
and
ClassType E;
Class Type F;
F = e; //call assignment operator
4. When a class contains a pointer member, the meaning of the two is very different. The
copy constructor allocates memory space for the pointer variable and copies the value of the argument to it, while the assignment operator implements the function to copy the value to the left value to the right of the ' = ' sign, and then to release and then apply when the left object is low on memory. Of course, the assignment operator must detect if it is itself assigned, and if it returns the current object's reference without assigning an action
The difference between a C + + copy constructor and an assignment