单项选择题
有如下程序: #include
using namespaee std; class GA{ public: virtual int f(){return 1;} }; class GB:public GA{ public: virtual int f(){return 2;} }; void show(GA g){cout<
A.1111
B.1211
C.1112
D.1212
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有如下程序:#includeusing namespace std;class Base{int x;public:Base(int n=0):x(n){cout<<n;}int getX()const{return x;}};class Derived:public Base{int y;public:Derived(int m,int n):y(m),Base(n){cout<<m;}Derived(int m):y(m){cout<<m;}};int main(){Derived d1(3),d2(5,7);return 0;}执行这个程序的输出结果是( )。
A.375
B.357
C.0375
D.0357
点击查看答案&解析
单项选择题
有如下程序: #include<iostream> using namespace std; class AA{ int k; protected: int n; void setK(int k){this->k=k;} public: void setN(int n){this->n=n;} }; class BB:public AA{/*类体略*/}; mt mmn() { BB x; x.n=1://1 x.setN(2);//2 x.k=3;//3 x.setK(4);//4 return 0; } 在标注号码的四条语句中正确的是( )。
A.1
B.2
C.3
D.4
点击查看答案&解析
相关试题
请使用VC6或使用【答题】菜单打开考生文件...
请使用VC6或使用【答题】菜单打开考生文件...
请使用VC6或使用【答题】菜单打开考生文件...
下列语句都是程序运行时的第1条输出语句,...
C++系统预定义了4个用于标准数据流的对...