I think this could be something to do with stack vs heap. When you use the new keyword, you're allocating memory on the heap. The previous instance of this object, in your case v is allocated on the stack.
When you use new, you're no longer using the same address as what you've passed in. Therefore, the instance in main is unchanged.
One other thing that should be noted is that you're not freeing the dynamically allocated memory in your function. You have a memory leak.
Run this example...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void MyFunction( int *x )
std::cout << "Address of x: " << x << std::endl;
x = newint;
std::cout << "New address of x: " << x << std::endl;
int main( int argc, char* argv )
int y = 10;
std::cout << "Address of y: " << &y << std::endl;
MyFunction( &y );
std::cout << y << std::endl;
I'm sure this is just for the sake of example, but I can't think of a good time when you'd ever need to do this.