code_junkie

Destructor question C++

Nov 13th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. vector<SomeClass> theVector;
  2.  
  3. type `class Vector<SomeClass>' argument given to `delete', expected pointer
  4.  
  5. int main()
  6. {
  7. vector<SomeClass> theVector;
  8.  
  9. vector<SomeClass>* ptrVctor = new vector<SomeClass>();
  10.  
  11.  
  12. delete ptrVctor; // ptrVctor must be deleted manually
  13. // theVector destroyed automatically here
  14. }
  15.  
  16. vector<SomeClass> theVector;
  17.  
  18. vector<SomeClass> *theVectorPtr = new vector<SomeClass>();
  19.  
  20. delete theVectorPtr;
  21.  
  22. int theInt;
  23. delete theInt;
  24.  
  25. ClassA * pobj_class = new ClassA();
  26.  
  27. ClassA obj_class();
  28.  
  29. theVector.resize(0);
Add Comment
Please, Sign In to add comment