填空题

在MyClass类的定义中,对赋值运算符"="进行重载。请将画线处缺失的部分补充完整。【 】 MyClass::operator==(const MyClass&rhs) { if(this==&rhs )return*this; value=rhs.value; retum*this; }

【参考答案】

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

单项选择题
有以下程序:#include main(){ FILE *fp; int i,k,n; fp=fopen( data.dat , w+ ); for(i=1;i<6;i++){fprintf(fp, %d ,i);if(i%3==0) fprintf(fp, n );}rewind(fp);fscanf(fp, %d%d ,&k,&n); printf( %d %d n ,k,n);fclose(fp);}程序运行后的输出结果是______。
A.0 0
B.123 45
C.1 4
D.1 2
单项选择题
有以下类定义classPoint{public:Point(int x=0,int y=0){_x=x;_y=y;}void Move (int xOff,int yOff{_x +=xOff;_y+yOff}void Print() const{cout<<’’(’’<<_x<<’’,’’<<_y<<’’)’’<<endl;}private:int_x_y;};下列语句中会发生编译错误的是【 】
A.Pointpt;pt;Print();
B.const Point pt;pt.Print();
C.Pointpt;pt.Move(1,2);
D.const Point pt;pt.Move(1,2);
相关试题
  • 已知程序的结果为123,请填空。#includ...
  • 已知字符A的ASCII代码值为 65,以下程序...
  • C++语言的基本控制结构为顺序结构、选择...
  • 下列程序的输出结果是【 】#include<ios...
  • C++语言的参数传递机制包括传值和传地址...