When I do:
for(i=0; i
s
When you use push_back to add an element to a vector, it is copied into the vector. The means that, in the first example, vectorA contains a copy of objectA, and objectA goes out of scope and gets deleted right after the closing brace. This means that the pointer in pvectorA is pointing at at an address that doesn't necessarily contain objectA any more.
Your second example shouldn't work, because objectA has gone out of scope after the first loop, so I can't help you there.