after this function call, would the object
It will be changed if
trans.revenue is not zero, as the same fields in
Total are affected by the
+= statements in the function implementation.
And what's the point of returning the *this?
It lets you chain further calls to member functions, so you could do something like:
That would combine values from both
Sales_data has other functions, you could use the return value of
combine to access them too. For example, if there's an
operator<<(std::ostream&, const Sales_data&) function for streaming a
Sales_data object, you could write...
std::cout << Total.combine(trans1) << '\n';
...which would merge the values from
Total before printing the updated values from