单项选择题

下面程序输出的结果是( )。 #include<iostream> using namespace std; class A{ int X; public: A(int x):x(++x){} ~A(){cout<<x;} }; class B:public A{ int y; public: B(int y):A(y),y(y){} ~B(){cout<<y;}; }; void main(){ B b(3); }

A.34
B.43
C.33
D.44
<上一题 目录 下一题>
热门 试题

单项选择题
应在下面程序下划线中填写的正确的语句是( )。 #include <iostream> using namespace std; class A{ public: void test(){cout<< this is A! ;} }; class B:public A{ void test(){ ______ 显示调用基类函数test() cout<< this is B! ; } }; void main(){}
A.A::test()
B.test()
C.B::test()
D.this->test()
单项选择题
下面程序输出的结果是( )。 #include<iostream> using namespace std; int test(int n1,int n2) {return n1 +n2;} float test (int f1,float f2){return f1-f2;} float test(float x,float y){return(x+y) 2;} float test(float x,int y){return(x+y)*2;} void main(){ int a1=10; float a2=2.5f; cout<<test(a1,a2); }
A.12.5
B.7.5
C.6.25
D.25
相关试题
  • 根据下面的程序,可以在主程序中使用的合法...
  • 根据下面的程序,可以在主程序中使用的合法...