单项选择题
若有以下程序:
#include <iostream>
using namespace std;
class Base
public:
Base ()
x=0;
int x;
;
class Derived1 : virtual public Base
public:
Derived1 ()
x=10;
;
class Derived2 : virtual public Base
public:
Derived2 ()
x=20;
;
class Derived : public Derived1,protected Derived2 ;
int main()
Derived obi;
cout<<obj.x<<endl;
return 0;
该程序运行后的输出结果是
A.20
B.30
C.10
D.0
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
若有一个MyClass类,则执行语句MyClass a,b(2),*p;后,自动调用该类的构造函数( )次。
A.2
B.3
C.4
D.5
点击查看答案&解析
单项选择题
为了使模块尽可能独立,要求
A.模块的内聚程序要尽量高,且各模块间的耦合程度要尽量强
B.模块的内聚程度要尽量高,且各模块间的耦合程度要尽量弱
C.模块的内聚程度要尽量低,且各模块间的耦合程度要尽量弱
D.模块的内聚程度要尽量低,且各模块间的耦合程度要尽量强
点击查看答案&解析
相关试题
有以下程序: class Date public: Dat...
有以下程序; #include <iostream> u...
有以下程序: #include <iostream> u...
若有以下程序: #include <iostream>...
有如下类声明: class MyBASE int k;...