Create and destroy an object in a loop

后端 未结 3 742
傲寒
傲寒 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:56

    Object one will be deleted automatically when it goes out of scope at the end bracket. You are already doing it. Be wary as if you create a pointer it will not be destructed when it goes out of scope. But your current code is working fine.

    http://www.tutorialspoint.com/cplusplus/cpp_variable_scope.htm

提交回复
热议问题