I have the following setup:
//.h
class Cell
{
private:
POINT mCellStartingPoint;
int mXoffset;
int mYoffset;
public:
static void DrawRowOfPixels(int yoff);
Cell();
~Cell();
};
//.cpp
void Cell::DrawRowOfPixels(int yoff)
{
HDC dc = GetDC(NULL);
COLORREF red = 0xFF0000;
for(int i = mCellStartingPoint.x; i < mXoffset; i++)
{
SetPixel(dc, mCellStartingPoint.x + i, mCellStartingPoint + yoff, red);
}
}
However, when implementing the DrawRowOfPixels() method in the .cpp file, I get errors at all of the member variables of the Cell class. (i.e. mCellStartingpoint, mXoffset, and mYoffset)
error C2228: left of '.x' must have class/struct/union
error C2597: illegal reference to non-static member 'Cell::mXoffset'
error C3867: 'Cell::mXoffset': function call missing argument list; use '&Cell::mXoffset' to create a pointer to member
error: A nonstatic member reference must be relative to a specific object
I know I'm probably doing something really stupid, but what's going on here? Why can't I use my private member variables inside my static member function like I should be able to?