有如下程序:#nclude <iostream>using namespace std;class Base{ public:void fun1() {cout << "Base\n"; }virtual void fun2() {cout << "

admin2009-01-15  29

问题 有如下程序:#nclude <iostream>using namespace std;class Base{    public:void fun1() {cout << "Base\n"; }virtual void fun2() {cout << "Base\n"; }};class Derived: public Base{    public:void fun1() {cout << "Derived\n"; }void fun2() {cout << "Derived\n"; }}  void f(Base& b) { B. fun1(); B. fun2(); }int main(){Derived obj;f(obj);return 0;}

选项 A、Base    Base
B、Base    Derived
C、Derived    Base
D、Derived    Derived

答案2

解析
转载请注明原文地址:https://jikaoti.com/ti/mtd0FFFM
0

最新回复(0)