String * ptr_str = static_cast(3*malloc(sizeof(String)));only Allocates the memory ;String * ptr_str2 = new String[3];calls the constructure of string class;delete[]ptr;if delete ptr only delte string[0]
本文共 272 字,大约阅读时间需要 1 分钟。
String * ptr_str = static_cast(3*malloc(sizeof(String)));only Allocates the memory ;String * ptr_str2 = new String[3];calls the constructure of string class;delete[]ptr;if delete ptr only delte string[0]
转载于:https://www.cnblogs.com/leetcode/p/3271797.html