I'm trying to build a class called Tile. The class will hold a position for drawing the tile to the screen, and a string array to hold the image (the image has to be in ascii characters). I'm using Microsft.Net Visual C++ 2003.
Here's the code from my .h file:
The error occurs on the constructor..."error C2062: type 'int' unexpected."Code:#ifndef _TILE_H_ #define _TILE_H_ const int T_WIDTH = 5; // width of the tile const int T_HEIGHT = 4;// height of the tile //--------------------------------------------------------- struct Position { int X; int Y; Position & operator = (Position rhs) { X = rhs.X; Y = rhs.Y; return *this; } Position(int x, int y) { X = x; Y = y; } }; //--------------------------------------------------------- class Tile { public: Tile(int xPos, int yPos, string* img); ~Tile(); int X() const; int Y() const; void Draw() const; void MoveUp(); void MoveDown(); void MoveLeft(); void MoveRight(); private: Position myPos; string* myImg; }; #endif
I don't have a function named Tile anywhere else in my program. I'm not sure about any libraries the compiler includes, but if there is it should overload it anyway. I suspect there may be something wrong with my position struct.
Any help is greatly appreciated.



LinkBack URL
About LinkBacks


