https://blog.csdn.net/sumx2015/article/details/80232825
#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* b = new shape('b');
//delete b;
system("pause");
return 0;
}
构造
a
构造
b
请按任意键继续. . .
析构
b
析构
a
不new:栈