网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有如下类声明: 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


参考答案

更多 “ 有如下类声明: 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.4B.3C.2D.1 ” 相关考题
考题 有如下类声明: 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.4B.3C.2D.1

考题 有如下类声明: class MyBASE{ int k; public: void set(iht n){k=n;} int get()coast{return k;} }; class MyDERIVED:pnoted My BASE { protected: int j; public: void set(int m,int n){MyBASE::set(m);j=n;} int get()const{return MyBASE::get()+j;} }; 则类MyDERIVED中保护的数据成员和成员函数的个数是A.4B.3C.2D.1

考题 有如下程序: include using namespace std; class Pair{ int m, n; public: Pair(int 有如下程序:#include<iostream>using namespace std;class Pair{int m, n;public:Pair(int j, int k):m(j), n(k){}int get(){return m;}int get()const{return m+n;)};int main() {Pair a(3, 5);const Pair b(3, 5);cout<<a. get()<<b. get();return 0;}运行时的输出结果是( )。A) 33B) 38C) 83D) 88A.B.C.D.

考题 有如下类声明: class MyBASE{ int k; public: void set(int n){k=n;} int get( )const{return k;} }; class MyDERIVED:protected MyBASE{ protected: intj; public: void set(int m,int n){MyBASE::set(m);j=n;} int get( )const{return MyBASE::get( )+j;} }; 则类MyDERIVED中保护的数据成员和成员函数的个数是A.4B.3C.2D.1

考题 有如下程序:include using namespace std;class AA {int n;public:AA(int k):n(k) {} 有如下程序:#include <iostream>using namespace std;class AA { int n;public: AA(int k):n(k) {} int get(){return n;} int get()const { return n+1; }};int main(){ AAa(5); const AA b(6); cout<<a. get()<<b. get(); return ();}执行后的输出结果是( )。A.55B.57C.75D.77

考题 有如下类声明: 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.4B.3C.2D.1

考题 以下程序的输出结果是#include "stdio.h"int *fun(int *a,int *b){ int m; m=*a; m+=*b-3; return(m);}main(){ int x=21,y=35,*a=x,*b=y; int *k; k=fun(a,b); printf("%d\n",*k);}

考题 有如下类声明: 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.4B.3C.2D.1

考题 有如下类声明: 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.4B.3C.2D.1