Deleting an object in C++

前端 未结 6 1870
清酒与你
清酒与你 2021-02-01 03:56

Here is a sample code that I have:

void test()
{
   Object1 *obj = new Object1();
   .
   .
   .
   delete obj;
}

I run it in Visual Studio, an

6条回答
  •  [愿得一人]
    2021-02-01 04:14

    saveLeaves(vec,msh);
    I'm assuming takes the msh pointer and puts it inside of vec. Since msh is just a pointer to the memory, if you delete it, it will also get deleted inside of the vector.

提交回复
热议问题