#include <iostream>
using namespace std;
class A
{
public:
A()
{
cout << "构造函数";
count++;
cout <<count<<endl;
}
~A()
{
cout << "析构函数"<<count<<endl;
count--;
}
private:
int x;
int y;
static int count;
};
int A::count=0;
void main()
{
A **p = NULL;
p = new A*[10];
for(int i=0;i<10;i++)
{
p[i] = new A;
}
for(int i=0; i<10;i++)
{
delete p[i];
}
delete p;
p=NULL;
}
转载于:https://www.cnblogs.com/SunkingYang/p/11049225.html