- #36
yungman
- 5,755
- 292
Both function return temp object and copy into L3. The function ended and destroyed, but the temp is being returned back.jtbell said:......
The first version returns a reference to a local variable (a variable that is declared insideoperator+()
). What happens to local variables afteroperator+()
finishes and you return tomain()
, or to whatever function calledoperator+()
?