填空题
补充完整下面的类定义:
class XCH
char*a;
public:
XCH(char*a A) //构造函数
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*this
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
有如下程序: #include<iostream> using namespaee std;c lass Animal public: virtual char*getType( )constreturn Animal ; virtual char*getVoice( )constreturn Voice ; ; class Dog:public Animal public: char*getType( )constreturn Dog ; char*getVoice( )eonstreturn Woof ; ; void type(Animal&A) cout<<a.getType( ); void speak(Animal A) eout<<a.getVoice( ); int main( ) Dog d;type(D) ;cout<< speak ;speak(D) ;cout 程序的输出结果是______。
点击查看答案&解析
填空题
非成员函数应该声明为类______函数才能访问该类的私有成员。
点击查看答案&解析
相关试题
补充完整下面的模板定义: template<clas...
补充完整下面的类定义: const double P...