问答题

#include < iostream.h >
class X
{ public:
int x;
public:
X( int x)
{ cout << this - > x = x << endl; }
X( X& t)
{x=t.x;
cout << t.x << endl;
}
void fun(X);
};
void fun(X t)
{ cout << t.x << endl; }
void main ()
{ fun(X(10));}

【参考答案】

cout<<this->x=x<<endl; 要输出this->x=x,则表达式的值要加括号。应改为cout<<(thi......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)