No, I dont think the operator=() would take place of copy constructor when an explicit copy constructor is not defined the class.
A copy constructor is provided by the compiler when one not defined explicitly in the class. So either one is invoked, but not =() as a replacement for that
In the case of
1 2
|
CEquation CEquation::Self()
{ return *this; }
|
yes, it would invoke the copy constructor to copy the returned object to temp object. You can check yourself by writing a simple copy constructor with a simple cout statement to trace the copy constructor's call.
But if the Self() returns a reference then, as you know, it would not call any copy constructor. Because it is a reference and no temp to copy.
And to you note, if the explicit =() removed it works, yes obviously it would work as there is no explicit =() to receive the parameter by reference. It would obviously use a copy constructor provided by the compiler, which does bitwise copy.
Please note, when an explicit copy constructor and =() not provided in a class,
the assignment operator expression may call the compiler provided =() or copy constructor, it is implementation dependent. I guess, it calls copy constructor for the assignment too.
EDIT: Yes, it apparently is a wrong statement. As I realized later that an implicit default constructor, copy constructor, destructor and an assignment =() methods are provided by compiler hence the relevant method would be invoked when an explicit is not provided. Meaning, one would not be invoked for another. Implicit or explicit, its respective method would be called for copy constructor or =(), but not one for another.
Check it out. Good luck :)