I have a general C++ question.
Lets say I have this code:
int& GetInt()
{
int* num = new int();
return *num;
}
int numCopy = GetInt();
In this situation, what happens to the returned reference? This example uses a simple data structure so it doesn't really matter, but in cases where the returned data is more complex, would assigning a variable to a heap-allocated variable reference like this copy the data over to numCopy completely, or would numCopy become another reference to the original num?