Take the 2-minute tour ×

Possible Duplicate:
Overloading assignment operator in C++
C++ why the assignment operator should return a const ref in order to avoid (a=b)=c

Why do most books recommend that the assignment operator return a refernce to this? Why not a const reference?

const will make strange code like (a=b)=c not compile which is a good thing.

share|improve this question

marked as duplicate by Oliver Charlesworth, Jason S, pmr, Ninefingers, Mat May 7 '12 at 13:17


...and this: stackoverflow.com/questions/2649068/… –  Jason S May 7 '12 at 13:17

Browse other questions tagged or ask your own question.