问答题
下面程序运行的结果是:5+10 =15。
#include<iostream.h>
class Test
{ private:
int x, y;
public:
Test() {x=y=0;}
void Setxy(int x, int y) {______}
void show() {______}
};
void main()
{ Test ptr;
ptr.Setxy(5, 10);
ptr.show();
}
【参考答案】
(*this).x=x; (*this).y=y; cout<<x<<"+"<<y<<"="<<x+y<<endl;