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

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

B.3

C.2

D.1


相关考题:

( 31 ) 有如下类定义 :class MyBase{int k;public:MyBase(int n=0):k(n){ }int value( )const{ return k;}};class MyDerived: MyBase{int j;public:MyDerived(int i): j(i) {}int getK( )const{ return k; }int getJ( )const{ return j; }};编译时发现有一处语法错误 , 对这个错误最准确的描述是A )函数 getK 试图访问基类的私有成员变量 kB ) 在类 MyDerived 的定义中,基类名 MyBase 前缺少关键字 public ,protected 或 privateC )类 MyDerived 缺少一个无参的构造函数D )类 MyDerived 的构造函数没有对基类数据成员 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

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

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

已知类X的定义如下,为了实现将对象成员k的值修改为678,下面的哪条语句是正确的 ______。 class X{ private: int k; public: K(int n){k=n;} set(int n){k=m;} }; void fun(){ X a(10),*p=a; ______ }A.p->set(678);B.X(678):C.p->k=678;D.p.set(678);

有如下类定义: class MyBase{ int k; public: MyBase(int n=O):k(n)}} int valueeonst{return k;} }; class MyDerived:MyBase{ intj; public: MyDerived(int i):j(i)}} int getKconst{return k;} int getJconst{return j;} }; 编译时发现有一处语法错误,对这个错误最准确的描述是( )。A.函数9etK试图访问基类的私有成员变量kB.在类MyDerived的定义中,基类名MyBase前缺少关键字public、protected或privateC.类MyDerived缺少一个无参的构造函数D.类MyDerived的构造函数没有对基类数据成员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