how much does the default destructor do

后端 未结 5 2119
死守一世寂寞
死守一世寂寞 2021-02-14 04:11

Does the default destructor in C++ classes automatically delete members that are not explicitly allocated in code? For example:

class C {
  public:
    C() {}
           


        
5条回答
  •  有刺的猬
    2021-02-14 04:55

    You don't have to write a destructor. C++ class has the default destructor to delete the object after 'return 0' to recycle the memory.

提交回复
热议问题