Assume that I have a function foo() that returns object of class A by value
A foo() {
A a(...);
return A;
}
Now in function bar() I store a pointer to the return value of A
void bar() {
A* pA = &foo();
}
Will the return value go out of scope at the end of bar(), or is there any need to call a delete on pA ?