当前位置: 首页 > 工具软件 > delete > 使用案例 >

delete []与delete区别?

柴坚诚
2023-12-01

delete []与delete区别?

char* p1 = new char[10];

delete p1与delete [] p1

delete []p 和 delete p是一样的

但要是class,只调用一次析构函数

class A

{

...

}

A* p = new A [10];

delete p;//只调用一次析构函数

 类似资料: