世界上最高的火山是:还是C++运行结果的题 高手帮忙啊 这里没C++软件

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 03:18:57
3.给出下面程序运行的结果。
#include <iostream.h>
class A{
private:int X,Y;
public:
A(int myx,int myy){X=myx;Y=myy;}
void show(){cout<<"X="<<X<<" Y="<<Y<<endl;}
};
class B:public A{
private:int H,W;
public:
B(int myx,int myy,int myh,int myw):A(myx,myy){H=myh;W=myw;}
void show(){cout<<"H="<<H<<" W="<<W<<endl;}
};
void main()
{
B d(13,14,35,66);
d.show();
}
4.给出下面程序运行的结果。
#include <iostream.h>
class base{
public:
virtual int func () {return 10;}
};
class derived:public base{
public:
int func () {return 200;}
};
void main()
{
derived d;
base& b=d;
cout<<b.func()<<endl;
cout<<b.base::func()<<endl;
}

1.H=35 W=66

2.200
10

第3题好像有问题 应该是X=13 Y=14 H=35 W=66 我在C++中没有运行出来 第4题 都是200 这个也没有运行出来