主观

完成程序,使其输出结果为x=30

#include "stdafx. h"

#include ﹤iostream﹥

using namespace std;

class Sample

{private:

intx;public:Sample( )

 {

Sample(int a)

 {

 x=a;

}

void disp( )

{

cout﹤﹤"x="﹤﹤x ﹤﹤ endl;

}

friend Sample operator+( Sample &s1, Sample &s2);

};

_________

Sample &s1,

 Sample &s2)

 {

returm Sample(s1. x +s2. x);

}

void main( )

 {

Sample obj1(10);

Sample obj2(20);

Sample obj3;

_________;obj3. disp( );

}

参考答案
您可能感兴趣的试题
¥

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服