// .h
class Sierpinski
{
struct Point
{
float x;
float y;
};
typedef std::vector<Point> Container;
typedef Container::iterator Iter;
Container* points;
Point randomPoint;
public:
Sierpinski() { }
~Sierpinski();
};
// ....
//.cpp
Sierpinski::Sierpinski()
{
int screenW = GetWidth();
int screenH = GetHeight();
points = new Container();
randomPoint.x = screenW / 2;
randomPoint.y = screenH / 2;
points.push_back(randomPoint);
}
Line points.push_back(randomPoint) gives this error:
C:\Sierpinski\src\Sierpinski.cpp|37|error: request for member `push_back' in `((Sierpinski*)this)->Sierpinski::points',
which is of non-class type `std::vector<Sierpinski::Point, std::allocator<Sierpinski::Point> >*'|
I tried to change Point to a class instead of struct but still have the same error. I'm using Code Blocks with gcc in Windows 7. What am I doing wrong here?