主观

在下划线处填上适当的语句,使程序的输出结果如下:  n=30

#include ﹤ iostream.h ﹥

template﹤ class T ﹥

class Sample

{

T n;

public:

Sample( ){ }

Sample(T i){_________}

Sample﹤T﹥&operator+(const Sample﹤T﹥&);

void disp( ){cout﹤﹤"n="﹤﹤n﹤﹤endl;}

};

template﹤class T﹥

Sample﹤T﹥&Sample﹤T﹥::operator+(const Sample﹤T﹥&s)

{

static Sample﹤T﹥temp;  return temp;

}

void main( )

{

Sample﹤int﹥s1(10),s2(20),s3;

s3=s1+s2;

s3.disp( );

}

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

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服