使用VC6打开考生文件夹下的工程test20_1,此工程包含一个源程序文件test21_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:
(1,2)
5,6
(6,9)
源程序文件test20_1.cpp清单如下:
#include<iostream.h>
class A{
public:
A(int i,int j) { a=i; b=j; }
/**************** found *******************/
void Move( int x, iht y) {a+=x;b+=y}
void Show() {cout <<"("<<a<<","<<b<<")"<<end1;}
private :
int a,b;
};
class B:private A
{
public:
/**************** found *******************/
B(int i,int j,int k, int 1): (i,j) {x=k;y=1;}
void Show () { cout<<x<<", "<<y<<end1; }
void fun() {Move(3,5); }
/**************** found *******************/
void f1() {Show();}
private:
int x,y;
};
void main ()
{
A e(1,2);
e. Show ( );
B d(3,4,5,6);
d. fun();
d. Show ( );
d.f1();
}