高等继续教育 / 面向对象程序设计
正确率:推荐%
题型描述: 简答题
写出下面程序的执行结果:
#include<iostream.h>
class A{
int a,b;
public :
A(int i,int j){a=i;b=j;}
void move(int x,int y){a+=x;b+=y;}
void show( ){cout<<"("<<a<<","<<b<<")
";}
};
class B:privateA{
int x,y;
public :
B(int i,int j,int k,int l):A(i,j){x=k; y=l;}
void show( ){cout<<x<<","<<y<<endl;}
void fun( ){move(3,5);}
void f1( ){ A::show( ); }
};
void main( )
{A
e(1,2);e.show( ); Bd(3,4,5,6); D.fun( ); D.show( ); D.f1( ); }
参考答案:
佳题速递: