求解释!谢谢啦
#include<iostream>using namespace std;
class GA{
public;
virtual int f(){retum l;}
};
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);
retum 0;
}
为什么答案运行时 1112