Create and destroy an object in a loop

后端 未结 3 730
傲寒
傲寒 2021-01-29 03:51

I am new to C++/stacko and want to principally:

  1. Create an object
  2. Read in an enormous amount of data for that
  3. After calculating that object\'s sc
3条回答
  •  有刺的猬
    2021-01-29 04:54

    It is not necessary to delete object1.

    For every iteration of the loop, a new object object1 will be created (using default constructor) and destructed after the "cout" statement.

提交回复
热议问题