核辐射的危害有多大:我有两个程序看不懂 请那位能够写出结果 谢谢

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/11 05:55:19
#include "iostream.h"
int &(int &i) {i=i+20; returni;}
void main()
{int k=5;
int & m=f(k);
cort<<k<<""; m=30;
cort<<k<<end1;}
{i=i+20;
return i;}
void main()
{int k=5;
int & m=f(k);
cort<<k<<"";
m=30;
cort<<k<<end1;}
2题 #include "iostream.h" class class my_base
{int a,b;
public:
my_base(int x,int y)
{a=x;b=y;}
virtual void show()
{cout<<"my_base----\n";
cout<<a<<""<<b<<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();}
#include "iostream.h"
int &(int &i)
{i=i+20; return i;}
void main()
{int k=5;
int & m=f(k);
cort<<k<<"";
m=30;
cort<<k<<end1;}

2题 #include "iostream.h"
class class my_base
{int a,b;
public:
my_base(int x,int y)
{a=x;b=y;}
virtual void show()
{cout<<"my_base----\n";
cout<<a<<""<<b<<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();}

程序都不对哦当然没有结果哦

运行一下不就知道了?