单项选择题
有如下程序:
#include <iostream.h>
using namespace std;
class Base
protected:
int i:
public:
int j;
;
class Derived: public Base
int m:
public:
int n;
int main()
Derived d:
d.i=0; //[1]
d.J=0; //[2]
d.m=0; //[3]
d.n=0: //[4]
return 0;
其中主函数中有两个赋值语句有错,这两个错误的赋值语句是
A.[1]和[2]
B.[1]和[3]
C.[2]和[3]
D.[2]和[4]
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有以下程序 #include <iostream> int i = 0; void fun( ) static int i = 1; std::cout<<i++<<’,’; std::cout<<i<<’,’; int main() fun(); fun(); return 0; 程序执行后的输出结果是
A.1,2,1,2,
B.1,2,2,3,
C.2,0,3,0,
D.1,0,2,0,
点击查看答案&解析
单项选择题
有以下类定义 class Point public: Pointint 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<<’)’ << end1; private: int_x,_y; ; 下列语句中会发生编译错误的是
A.Point pt;pt.Print();
B.const Point pt;pt.Print();
C.Point pt;pt.Move(1, 2);
D.const Point pt;pt.Move(1, 2)
点击查看答案&解析
相关试题
有以下程序: #include <iostream> u...