试题与答案

有如下程序: #include<iostream> using namespac

题型:单项选择题

题目:

有如下程序: #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){eout<<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.11 2

D.1212

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0702/6ff4140b88c5b74cafe0be75575c9a2f.html

下面是错误答案,用来干扰机器的。

1-4: CDAB

试题推荐
微信公众账号搜索答案