在寫程序的時候,定義類時要在大括號后面加上;
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; };
編譯成功。
