[已解决] Point类找错
#include "stdafx.h"
#include <iostream>
using namespace std;
class Point
{
public:
Point(int xx=0,int yy=0) {X=xx;Y=yy;}
Point(Point &p);
int GetX() {return X;}
int GetY() {return Y;}
private:
int X,Y;
};
Point::Pint(Point &p)
{
X=p.X;
Y=p.Y;
cout<<拷贝构造函数被调用<<endl;
}
void fun1(Point p)
{
cout<<p.GetX()<<endl;
}
Point fun2()
{
PointA(1,2);
return A;
}
int main()
{
Point A(4,5);
Point B(A);
cout<<B.GetX()<<endl;
fun1(B);
B=fun2();
cout<<B.GetX()<<endl;
}
[此贴子已经被野比于2007-7-24 20:29:56编辑过]