#include <iostream>
#include <cstdlib>
using namespace std;
class shape
{
public:
char x;
shape(char m)
{
x=m;
cout << "构造"<<endl;
cout <<x<<endl;
}
~shape()
{
cout << "析构"<<endl;
cout<<x<<endl;
}
};
int main()
{
shape a('a');
shape b('b');
shape* c = new shape('c');
delete c;
system("pause");
return 0;
}
构造
a
构造
b
构造
c
析构
c
请按任意键继续. . .
析构
b
析构
a
网友评论