64,642
社区成员
发帖
与我相关
我的任务
分享
class X
{
public:
X()
{
cout<<"1"<<endl;
}
X(const X&){cout<<"2"<<endl;}
X&operator=(const X& b){cout<<"3"<<endl; return *this;}
~X(){cout<<"4"<<endl;}
};
void f(X b)
{cout<<"5"<<endl;}
int main(int argc, char* argv[])
{
X a;
X b;
b=a;
f(a);
X c=b=a;
cout<<"6"<<endl;
return 0;
}