[单选题]

有以下程序:inClUdeusingnamespacestd;ClassBase{public: Base(intx) {a=x; } voidsh

有以下程序: #inClUde <iostream> using namespace std; Class Base { public: Base(int x) { a=x; } void show() { cout<<a; } private: int a; }; class Derived : public Base { public: Derived(int i) :Base(i+1),b(i){} void Show() { cout<<b; } private: int b; }; int main() { Base b(5),*pb; Derived d(1); pb=&d; pb->show(); return 0; } 运行后的输出结果是( )。

A.1

B.5

C.2

D.0

参考答案与解析:

相关试题

有以下程序:#inClUdeusingnamespacestd;ClassBas