单项选择题

有如下类声明:
class MyBASE

int k;
public:
void set(int n)k=n;
int get()constreturn k;
;
class MyDERIVED:protected MyBASE

protected:
int j;
public:
void set(int m, int n) MyBASE::set(m);j=n;
int get()constreturn MyBASE::get()+j;
;
则类MyDERIVED中保护的数据成员和成员函数的个数是

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

单项选择题
以下程序段共有错误( )处。 #include <iostream> using namespaces std; class Sample private: int n; public: Sample (int i) n=i; void setvalue(int i) n=i; void display() cout<< n= <<n<<endl ; ; int main() const Sample a(10); a.setvalue(5); a.display(); return 0;
A.1
B.2
C.3
D.4
单项选择题
以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; void try(int x,int y,int z,int r) z = x+y; x = x*x; y = y*y; r = z+x+y;
A.18
B.9
C.10
D.不确定
相关试题
  • 有以下程序: #include <iostream> u...
  • 有以下程序 #include <iostream> usi...
  • 下面是复数类complex的定义,其中作为友元...
  • 已知int DBL(int n)return n+n;和lo...
  • 有以下程序 #include <iostream> usi...