【发布时间】:2011-02-27 01:22:55
【问题描述】:
我已经翻遍了,我找不到任何与我的问题有关的东西。我试图为一个多边形类编写一个类定义,该类基本上具有一个包含指向一个点的指针的向量。当我尝试编译时,我不断收到以下错误...
错误 C2143:语法错误:缺少 ';'在'
这是类的代码
#include "Point.h"
#include <vector>
class Point;
class Polygon
{
private:
vector<Point*> myPolygonPoints;
bool myHasIntersection;
public:
void addSetOfPoints(vector<Point*> points)
{
myPolygonPoints = points;
}
bool getHasIntersection()
{
return myHasIntersection;
}
void setHasIntersection(bool intersection)
{
myHasInstersection = intersection;
}
};
【问题讨论】:
-
风格说明:最好先显示
public部分,然后是protected,最后是private部分。该类的用户只对第一个感兴趣(在继承的情况下可能是第二个),并且不太关心private一个,因此无需将其放在她的视线中。 -
我不能为别人说话,但我总是有兴趣看到私人细节。
标签: c++ templates compiler-errors