<strong><em><span style="font-size:18px;color:#000066;">#include <iostream>
using namespace std;
class A
{
int a , b ;
public :
A( ) //无参构造函数
{
a=b=0;
cout <<"a="<<a<<","<<"b="<<b<<endl;
}
A(int aa, int bb): a(aa),b(bb)//有参构造函数
{
cout <<"a="<<a<<","<<"b="<<b<<endl;
}
~A( )
{
cout<<"Destructor "<<a<<" "<<b<<endl;
}
};
int main()
{
A x, y(2, 3);
return 0; //调用两次析构函数,按照定义的反顺序调用
}
</span></em></strong>
第四周 阅读程序
