I was reading through some c++ source code, and i came over some syntax.
path& path::operator+=(string postPath)
and i was wondering whether it is actual syntax and why c++ is not using the already existing operator+ instead combined with applying the value to the object in question.
Is it like, if you want to make sure that the object gets deleted properly. But the destructor should deal with all of that.
-Edit1
I know there is a difference between a += b; and a + b;
What i was wondering was why does c++ not just use the operator+ with the += instead of having to redefine the operator+= as the same as the operator+
-Edit2
Im not sure it came across correctly, but what i was asking was why the language doesn't infer += based on +. And now i realize the other uses of +=. Thanks everyone :)