blah
F test = getF();
// Print out shows that an F object was destroyed by the ~F. F set
var to 0 on delete;
test.print();
//reveals that var is still 123
value is 123 still instead of 0
F getF()
{
F f;
//default is 0;
f.setVar(123);
return f;
}
I thought since I created this on the stack instead of the heap that I
would run into problems. I have not overloaded anything. I thought
the best way would be to return a pointer to the heap and create the
object on the heap as well.
What did I miss, and why does this work? I thought that I had to do
some overloading to make data copy as well.