I've got a class Pacman declared as follows:
In the implementation file, Pacman.cpp, I haveCode:#ifndef PACMAN_H #define PACMAN_H #include "Character.h" #include "Map.h" class Pacman : public Character { public: static const double STARTING_XPOSITION; static const double STARTING_YPOSITION; static const Tile STARTING_TILE; Pacman(); Pacman(std::string name, Position position, int state = ACTIVE, int direction = LEFT, double speed = NORMAL, int pillsTaken = 0); ...
tiledMap is simply a static 2d array of Tile objects.Code:const Tile Pacman::STARTING_TILE = Map::tiledMap[10][11];
If I make the Pacman constructor print out the data of Map::tiledMap[10][11] it does it correctly so it clearly has access, but instead of STARTING_TILE being assigned the values of tiledMap[10][11] (which is a Tile), it just has the values given by the default constructor for Tile.
I haven't defined any assignment operators so the compiler is just using the default which is what I want... So why isn't STARTING_TILE being assigned the data of tiledMap[10][11]?



LinkBack URL
About LinkBacks



