A.函数getK试图访问基类的私有成员变量k
B.在类MyDerived的定义中,基类名MyBase前缺少关键字public、protected或private
C.类MyDerived缺少一个无参的构造函数
D.类MyDerived的构造函数没有对基类数据成员k进行初始化
[单选题]有如下类定义: 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( )eonst{return k;} int getJ( )const{return j;} }; 编译时发现有一处语法错误,对这个错误最准确的描述是A.函数getK试图访
[单选题]( 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. )函数
[单选题]有如下类声明: 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中保护的数据
[单选题]有如下类声明: 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中
[单选题]有如下类声明: 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;} }; 则类MyDERIVE
[单选题]有如下类声明: 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中保护
[单选题]有如下类声明: 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中保护
[单选题]有如下类声明: 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中保
[单选题]有如下类定义: ClaSS MyClass{ int value; public: MyClass(int n):value(n){ } int getValue( )const{return value;} l; 则类MyClass的构造函数的个数是A.1个B.2个C.3个D.4个
[单选题]有如下类定义:class AA{int a;public:int getRef() const{return &a;} // ①int getvalue() const{return a;} // ②void set(int n) const{a=n;} // ③friend void show(AA aa) const {cout< // ④};其中的四个函数定义中正确的是A. . ①B. . ②C. . ③D. . ④