单项选择题
有如下程序:
#include<iostream>
using namespace std;
int i=1;
class Fun
public:
static int i;
int value()return i-1;
int value()constreturn i+1;
;
int Fun::i=2;
int main()
int i=3;
Fun fun1;
const Fun fun2;
______
return 0;
若程序的输出结果是:
123
则程序中下画线处遗漏的语句是______。
A.cout<<fun1.value()<<Fun::i<<fun2.value();
B.cout<<Fun::i<<fun1.value()<<fun2.value();
C.cout<<fun1.value()<<fun2.value()<<Fun::i;
D.cout<<fun2.value()<<Fun::i<<fun1.value();
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有如下程序: #include<iostream> using namespace std; class Base public: void fun()cout<< Base::fun <<endl; ; class Derived:public Base public: void fun() ______ cout<< Derived::fun <<endl; ; int main() Derived d; d.fun(); return 0; 已知其执行后的输出结果为: Base::fun Derived::fun 则程序中下画线处应填入的语句是______。
A.Base.fun();
B.Base::fun();
C.Base->fun();
D.fun();
点击查看答案&解析
单项选择题
有如下程序: #include<iostream> using namespace std; class MyClass public: MyClass()cout<<’A’; MyClass(char c)cout<<c; ~MyClass()cout<<’B’; ; int main() MyClass p1.*p2; p2=new MyClass(’X’); delete p2; return 0; 执行这个程序的输出结果是______。
A.ABX
B.ABXB
C.AXB
D.AXBB
点击查看答案&解析
相关试题
下列关于C++流的描述中,错误的是___...
在下列枚举符号中,用来表示“相对于当前位...
有如下程序: #include<iostream> usi...
有如下类定义: class MyBase int k;...
关于关键字class和typename,下列表述中正...