CodePudding user response:
Estimate is that the rear + + returns a temporary MyInt, since then the original MyInt increases, then the makeshift MyInt as a parameter to the overloaded function to print, because of the overloaded function parameter is a reference type, and temporary variables can not quote, so wrong,CodePudding user response:
Hey hey, little brother and I used to like, this is because the rear + + overloading to add an int in the parameter list do a placeholder, for the difference between front rear + + and + +, and rear + + return without a copy of the front+ + returns have to add a reference itself,
CodePudding user response:
Here you overload & lt;CodePudding user response:
+ + returned temporary objects and functions you accept is a const reference