单项选择题

以下程序执行结果是 ( )。
#include <iostream.h>
class Base
public
virtual void fun() cout<<"B";
;
class Derived
public:
Derived() cout<<"D";
virtual void fun() Base::fun(); cout<<"C";
int main ()
Base *ptr;
Derived obj;
ptr=&obj;
p->fun ( );
return 0;

A.DBC
B.DCB
C.BDC
D.CBD
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序: #include <iostream> using namespace std; class A private: int x,y; public: void set (int i,int j) x=i; y=j; int get_y() return y; ; class box private: int length,width; A label; public: void set(int 1,int w, int s,int p) length=1; width=w; label.set(s,p); int get_area() return length*width; ; int main() box small; small.set(2,4,1,35); cout<<small.get_area()<<end1; return 0; 运行后的输出结果是( )。
A.8
B.4
C.35
D.70
单项选择题
以下程序执行后的输出结果是 ( )。 #include <iostream.h> class Basel public: void fun() cout<< Basel <<end1; ; class Base2 public: void fun() cout<< Base2 <<end1; class Derived : public Basel,public Base2 ; void main() Derived Obj; Obj.fun();
A.Basel
B.Base2
C.BaselBase2
D.程序产生二义性
相关试题
  • 有如下的程序: #include <iostream>...
  • 以下程序运行后的输出结果是 【14】 。...
  • 经常和一个运算符连用,构成一个运算符函数...
  • 若有以下程序: #include <iostream>...
  • 在C++语言中,每个类都有一个隐含的指针...