I\'m doing some revision of my C++, and I\'m dealing with operator overloading at the minute, specifically the \"=\"(assignment) operator. I was looking online and came acro
The return type doesn't matter when you're just performing a single assignment in a statement like this:
x = y;
It starts to matter when you do this:
if ((x = y)) {
... and really matters when you do this:
x = y = z;
That's why you return the current object: to allow chaining assignments with the correct associativity. It's a good general practice.