|You really don't need a reference to a pointer here.
It can be a reference to an object.
void Swap(Person& a, Person& b)
Person& temp = a;
a = b;
b = temp;
Then in the above case it would be called as -
But objects need not be always created using
new like in C#.
In C++ you can create objects on the stack using the syntax -
Now the Swap call would be -
I love work. It gives me something to do between weekends.
modified on Friday, September 18, 2009 10:18 AM