new sum new [], delete sum delete [] | C ++

new new[] delete delete[]

When new and new[] are used in class creation | C++
https://blog.csdn.net/weixin_46096297/article/details/109150041
When creating a class to allocate storage space for an object in a dynamic way
, new and new in c++ [] is better than malloc and calloc in C, because the operators new and new[] can call the corresponding constructor when allocating storage space

Malloc and calloc cannot call the corresponding constructor when allocating storage space

Guess you like

Origin blog.csdn.net/weixin_46096297/article/details/109898627