[单选题]

若有以下程序:include using namespace std;class Base{private: int a,b;public: Ba

若有以下程序: #include <iostream> using namespace std; class Base { private: int a,b; public: Base(int x, int y) { a=x; b=y; } void show() { cout<<a<<", "<<b<<end1; } }; class Derive : public Base { private: int c, d; public: Derive(int x, int y, int z,int m):Base(x,y) { c=z; d=m; } void show() { cout<<c<<", "<<d<<end1; } }; int main ( ) { Base b(50,50) ,*pb; Derive d(10,20,30,40); pb=&d; pb->show {); return 0; }

A.10,20

B.30,40

C.20,30

D.50,50

参考答案与解析:

相关试题

若有以下程序:#include using namespace std;clas

[单选题]若有以下程序:include using namespace std;class Base {public:Base() { x=0; } int若有以下程序: #include <iostream> using namespace std; class Base { public: Base() { x=0; } int x; }; class Derivedl: virtual public Base { public: Derivedl() { x=10; } }; class Deriv

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{private: int a;public: A(int i若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp() { cout<<a<<", "; } }; class B { private: int b; public: B(int

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class Base{public:Base (){x=0;}int x;}若有以下程序: #include <iostream> using namespace std; class Base { public: Base () { x=0; } int x; }; class Derived1 : virtual public Base { public: Derived1 () { x=10; } }; class De

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{private:int a;public:A(int i){若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp () { cout<<a<<","; } }; class B { private: int b; public: B(int

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{public:A() { }A(int i){x1=i;}v若有以下程序: #include <iostream> using namespace std; class A { public: A() { } A(int i) { x1=i; } void dispa0 { cout<<"x1="<<x1<<","; } private: int x1; }; class B: public A { p

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{protected: int a;public: A() {若有以下程序: #include <iostream> using namespace std; class A { protected: int a; public: A() { a=10; } }; class A1 : public A { public: A1() { a=a+1; } }; class A2 : public A { publ

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class data{public: int x; data (int x)若有以下程序: #include <iostream> using namespace std; class data { public: int x; data (int x) { data: :x=x; } }; class A { private: data d1; public: A(int x) : d1 (x) { } void dispa

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{private: int x;protected: int若有以下程序: #include <iostream> using namespace std; class A { private: int x; protected: int y; public: int z; void setx(int i) { x=i; } int getx () { return x; }; class B : protect

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class myClass{private: int var;public:若有以下程序: #include <iostream> using namespace std; class myClass { private: int var; public: myClass(int i) { var=i; } void add() { s+=var; } static int s; void display() { cout<<

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class Base{ int x;protected: int y;pub若有以下程序: #include <iostream> using namespace std; class Base { int x; protected: int y; public: int z; void setx(int i) { x=i; } int getx ( ) { return x; } }; class Inherit : pri

  • 查看答案
  • 若有以下程序:#include using namespace std;clas