在写程序的时候,定义类时要在大括号后面加上;
class Point{
public:
Point(int a,int b);
Point(const Point &p);
int getx(Point p);
int gety(Point p);
private:
int x,y;
}
最后大括号一定要加上分号,上面是错误实例,编译出错
ew types may not be defined in a return type
所以一定别忘了结尾的分号;
class Point{
public:
Point(int a,int b);
Point(const Point &p);
int getx(Point p);
int gety(Point p);
private:
int x,y;
};
编译成功。