Home > Back-end >  The couple consult
The couple consult

Time:10-07

C + + assignment operator overloading why need to return?
For example:
A& The operator + (const A& M)
{x=m.x; Y=m.y; Return * A; }

No return value is arguably ah, not have finished the assignment operation?

CodePudding user response:

Buy this effective c + +, and have a look that is punctuated with,
The reason need the return value is for the use of the following ways:

A=b=c;

B=c before, it is necessary to give a assignment, so b=c need a return value,

CodePudding user response:

Ok thank you
  • Related