Quote:Original post by Anonymous Poster
man->addObject(*obj);
cout addObject(*obj2);
you are still passing by value, pass by reference instead.
man->addObject(obj);
cout addObject(obj2);
Your (AP's) code is passing by pointer, the syntax isn't changed at all for reference, except that the type is different (you add &). And as the AP said, it seems addObject still takes its parameter by value. Also you should delete everything which is created with new, anything else will result in a memory leak. So you should also delete man.