Why can't I change objects in a vector?
问题 I have a class TileGrid that holds an std::vector< std::vector<Tile> > . Accessing the Tile objects in the vector works, but I can't change their properties? For the sake of completion, here are all the relevant classes: tilegrid.h #include <vector> #include "tile.h" class TileGrid { public: TileGrid(); TileGrid(unsigned int rows, unsigned int cols); virtual ~TileGrid(); unsigned int getRows() const { return rows_; }; unsigned int getCols() const { return cols_; }; Tile atIndex(unsigned int