Solution

Since method is passed its argument by reference, it changes the original parameter. t has type string& so it is just a reference to s; so all along t and s actually share the same memory.



Leo Liberti 2008-01-12