单项选择题

有如下类声明: class MyBASE { int k; public: void set(int n){k=n;} int get()const{return k;} }; class MyDERIVED:protected MyBASE { protected: int j: public: void set(int m,int n){MyBASE::set(m);j=n;} int get()const{return MyBASE::get()+j;} }; 则类MyDERIVED中保护的数据成员和成员函数的个数是( )。

A.4
B.3
C.2
D.1
<上一题 目录 下一题>
热门 试题

单项选择题
若有如下程序: #include<iostream> using namespaee std; int fun() { static int i=0; int s=1; s+=i; i++; return s; } int main() { int i,a=0; for(i=0;i<5;i++) a+=fun(); cout<<a<<end1; return 0; } 程序运行后,输出的结果是( )。
A.20
B.24
C.25
D.15
单项选择题
下列程序的执行结果是______。 #include<iostream.h> #include<stdlib.h> class TestClass { public: int x,y; TestClass () {x=y=0;} TestClass (int a,int b){x=a;y=b;} void disp() { cout<< x= <<x<< ,y= <<y<<end1; } void main() TestClass s1(2,3); s1.disp(); }
A.x=2,y=2
B.x=2,y=3
C.x=3,y=2
D.x=3,y=3
相关试题
  • 下列程序输出的结果是( )。 #include...
  • 下列程序的输出结果是______。 #in...
  • 下列程序运行后的输出结果是( )。 #in...
  • 假定a=3,下列程序的运行结果是( )。...
  • 若有如下程序: #include<iostream> u...