给出下面程序的输出结果
#include ﹤iostream﹥
using namespace std;
class Simple
{
int x, y;
public:
Simple( ) { x=y=0; }
Simple( int i, int j) { x=i; y =j; }
void copy( Simple &s);
void setxy { int i, int j) { x=i; y=j; }
void print( ) { cout ﹤﹤"x="﹤﹤x﹤﹤",y="﹤﹤y ﹤﹤ endl; }
};
void Simple:: copy( Simple &s)
{
x=s.x; y=s.y;
}
void func ( Simple s1, Simple &s2)
{
s1. setxy(30, 40);
s2. setxy(70, 80);
}
vpid main( )
{
Simple obj1(1, 2), obj2;
obj2. copy(obj1);
func(obj1, obj2);
obj1. print( );
obj2. print( );
}
订单号:
遇到问题请联系在线客服
订单号:
遇到问题请联系在线客服