注册 登录
编程论坛 C++教室

[已解决] Point类找错

ddflovefbk 发布于 2007-07-24 08:27, 728 次点击

#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编辑过]

1 回复
#2
ddflovefbk2007-07-24 08:38

问题已经解决!!!!

1