大家帮我看看这个,为什么?
zqj50 2010-07-11 10:17:41 #include<iostream.h>
class Point
{
public:
int x;
int y;
Point()
{
x=0;
y=0;
}
Point(int a,int b)
{
x=a;
y=b;
}
~Point(){}
void output()
{
cout<<x<<endl<<y<<endl;
}
void output(int x,int y)
{
x=x;
y=y;
}
};
int main()
{
Point pt(3,3);
pt.output(5,5);
pt.output();
}
为什么结果输出是3 3而不是5 5;
而把红色字体里的x和y改成a和b就可以了呢?
谁来回答下吧,谢谢大家了....