填空题 使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正其中的错误,使程序正常运行,并且输出以下结果:
(4,5)
7,8
(4,8)
注意:错误的语句在//******error******的下面,修改该语句即可。
试题程序:
#include<iostream.h>
class TC0
{
public:
TC0(int i,int j)
{
x=i;
y=j;
}
//******error******
virtual void move(int a;int b)
{
X+=a;
y+=b;
}
void print()
{
cout<<"("<<x<<","<<y<<")"<<end1;
}
public:
int x,y;
};
class TC1:public TC0
{
public:
//******error******
TC1(int i,int j,int k):(i,j)
{
m=k;
n=1;
}
void print()
{
cout<<m<<","<<n<<end1;
}
void func()
{
move(3,5);
}
void display()
{
//******error******
print();
}
private:
int m,n;
};
void main()
{
TC0 obj(4,5);
obj.print();
TC1 obj1(1,3,7,8);
obj1.func();
obj1.print();
obj1.display();
}