圣杯战争caster:我有两道程序不懂 请帮我把结果 写出来 谢谢

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 02:52:01
#include "iostream.h" 2题 #include "iostream.h"
int &(int &i) class my_base
{i=i+20; {int a,b;
return i;} public:
void main() my_base(int x,int y)
{int k=5; {a=x;b=y;}
int & m=f(k); virtual void show()
cort<<k<<""; {cout<<"my_base----\n";
m=30; cout<<a<<""<<b<<end1;}
cort<<k<<end1;} };
class my_class:public my_base
{int c;
public:
my_class(int x,int y,int z);my_base(x,y)
{c=z;}
void show()
{cout<<"cy_class----\n";
cout<<c<<end1;}};
void main()
{my_base mb(50,50),*mp;
my_class mc(10,20,30);
mp=&mb;
mp->show();
mp=&mc;
mp->show();}