i have the following C++ class:
class N
{
private:
vector<F> setF;
public:
Node(vector<F>* f) { setF = *f;};
vector<F>* getSetF() { return &setF; };
void setSetF(vector<F> input) { setF= (input); };
};
Now, I create an object, namely obj of type N. Then I create a new vector of type N, namely avector, that should replace the vector inside obj. So, I write:
vector <F> *sta =obj->getSetF();
delete(sta);
obj->setF(avector);
Now the vector inside obj has size 0, hence the replacement of the vector failed, but I don't know why. Any help ?
Aucun commentaire:
Enregistrer un commentaire