生化危机6果体补丁:这段C++代码有何错误?编译不能通过

来源:百度文库 编辑:高考问答 时间:2024/04/29 18:55:33
#include <iostream>
#include <stdio>
#include <cstdlib>
#include <string>
using namespace std;
class X{
public:

X(int i){cout<<"constructing..."<<i;a=i;}
X(X& x){cout<<"copying..."<<x.a;a=x.a;}
~X(){cout<<"destroying..."<<a;}
protected:
int a;
};
X fa(X x){return x;}
int main(){
X a(1);
X b = fa(a);

cout<<endl;
system("pause");
}

报错:18 D:\Untitled2.cpp no matching function for call to `X::X(X)'