I was reading the following question:
How to "return an object" in C++?
(which asks about returning objects in C++)
and in particular, the following answer:
https://stackoverflow.com/a/3350418/997112
Thing calculateThing() {
    Thing thing;
    // do calculations and modify thing
     return thing;
}
surely this answer won't work because the variable defined will no longer exist, as it was on the stack and only in scope for the duration of the function?
 
     
     
     
    