15 29 C:\Users\dell\Desktop\Untitled1.cpp [Error] declaration of 'Point::Point(const Point&)' outside of class is not definition [-fpermissive]
void setX(int xx) {x=xx;}
void setY(int yy) {y=yy;}
int getX() {return x;}
int getY() {return y;}
private:
int x,y;
};
Point::Point(const Point&p);
{
x=p.x;
y=p.y;
cout<<"调用复制构造函数!"<<endl;
}
Point::~Point()
{
cout<<"调用构造函数!"<<endl;
}
void funl(Point p)
{
cout<<p.getX()<<endl;
}
Point fun2()
{
Point a(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;
return 0;
}