is this code ok? or is it the case that since obj is declared in the function, when the function ends and it goes out of scope, the item at the back of the vector member in MyClass will just be garbage or null? m_vector is of type std::vector<MyObject>Code:void MyClass::AttachObj(unsigned long* data, iny lengthOfData) { MyObject obj(); obj.SetMemberData(data,lengthOfData); m_vector.push_back(obj); }




Reply With Quote