有如下程序#includeusing namespace std;class GA{public:virtual int f( ) {return 1
19 查阅
有如下程序 #include<iostream> using namespace std; class GA{ public: virtual int f( ) {return 1;} }; class GB:public GA{ public: virtual int f() {return 2;} }; void show(GA g){cout<<g.f();} void display(GA&g){cout<<g.f();} int main() { GA a;show(A) ;display(A) ; GB b;show(B) ;display(B) ; return 0; }运行时的输出结果是
A.1111
B.1211
C.1112
D.1212
参考答案: