填空题
补充完整下面的类定义:
class XCH
char*a;
public:
XCH(char*aa) //构造函数
a=new char[strlen(aa)+1];
strcpy(a,aa);
XCH& operator=(const XCH& x) //重载赋值函数
delete[]a;
a=new char[strlen(x,a)+1];
strcpy(a,x,a);
______;
~XCH( )delete[]a;)
【参考答案】
return a
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
若下列程序运行时输出结果为 1,A,10.1 2,B,3.5 请将程序补充完整。 #include<iostream> using namespace std; int main() void test(mt,char,double______); test(1,’A’,10.1); test(2,’B’); return 0; void test(int a,char b,double c) cout<<a<<’,’<<b<<’,’<<c<<endl;
点击查看答案&解析
填空题
下列程序将x、y和z按从小到大的顺序排列,请将下面的函数模板补充完整。 template <class T> void order(______) T a; if (x>y) a=x; x=y; y=a; if (y>z) a=y; y=z; z=a; if (x>y) a=x; x=y; y=a;
点击查看答案&解析
相关试题
多数运算符既能作为类的成员函数重载,也能...