I am reading a C ++ Primer, in the chapter with an overloaded operation, the author gave an example:
// member binary operator: left-hand operand bound to implicit this pointer Sales_item& Sales_item::operator+=(const Sales_item&); // nonmember binary operator: must declare a parameter for each operand Sales_item operator+(const Sales_item&, const Sales_item&);
then the author explained:
This difference corresponds to the return data types of these operators when applied to arithmetic types: adding gives the assignment of rvalue and join, returns a link to the left operand.
I'm not quite sure about " compound assignment returns a reference to the left-hand operand
". Can anyone elaborate on this, and related things, please?
source share