填空题

要想把类的一般成员函数说明为类的常成员函数,则应该使用关键词 【11】 说明成员函数。

【参考答案】

const
<上一题 目录 下一题>
热门 试题

填空题
以下程序运行后的输出结果是 【14】 。#include <iostream>#include <string>using namespace std;class Y;class X{int x;char *strx;public:X(int a, char *str){x=a;strx=new char[strlen(str)+l];strcpy(strx,str);}void show(Y &ob) ;};class Y{private:int y;char *stry;public:Y(int b,char *str){y=b;stry=new char[strlen(str)+l];strcpy(stry, str);}friend void X::show(Y &ob) ;};void X::show(Y &ob) {cout<<strx<< , ;cout<<ob.stry<<end1;}int main(){X a(10, stringX );Y b(20, stringY );a. show (B) ;return 0;}
填空题
以下程序的输出结果是 【10】 。#include <iostream>using namespace std;int main(){char S[ ]= abcdef ;s[3]=’\0’;cout<<s<<end1;return 0;}
相关试题
  • 若有以下程序:#include <iostream>usi...
  • 下列程序将x、y和z按从小到大的顺序排列,...