去长沙玩了几天,没学
1.new 与 delete
通过调用分析了解到new在堆区开辟数据 delete就是释放数据
案例
#include<stdio.h>
#include <malloc.h>
class ae
{
public:
~ae()
{
printf("释放中");
};
private:
};
int main(int argc, char* argv[])
{
ae* a1 = new ae[10];
delete[] a1;
}
案例2
去长沙玩了几天,没学
1.new 与 delete
通过调用分析了解到new在堆区开辟数据 delete就是释放数据
#include<stdio.h>
#include <malloc.h>
class ae
{
public:
~ae()
{
printf("释放中");
};
private:
};
int main(int argc, char* argv[])
{
ae* a1 = new ae[10];
delete[] a1;
}