注意:此页面搜索的是所有试题
题目内容
(许昌学院面向对象程序设计)
[分析题,4分] class Base{ protected: int a;public:Base(int x,){a=x;}virtual void show(){ cout<<“base”<<endl; cout<<a<<“ “<<endl;}};class my_class:public Base{int b:public: my_class(int x,int y): Base(x){ b=y;}void show(){ cout<<“my_class” <<“a=”<<a <<“b=”<<b;}};void main{Base ma(50),*mp;my_class mb(10,20);mp=&mb;mp->show();mp=&ma;mp->show();}
参考答案