gameboard.h

来自「C++高级编程这本书所附的源代码」· C头文件 代码 · 共 29 行

H
29
字号
// GameBoard.hclass GamePiece {};class GameBoard{ public:  // The general-purpose GameBoard allows the user to specify its dimensions  GameBoard(int inWidth = kDefaultWidth, int inHeight = kDefaultHeight);  GameBoard(const GameBoard& src); // copy constructor  ~GameBoard();  GameBoard& operator=(const GameBoard& rhs); // assignment operator  void setPieceAt(int x, int y, const GamePiece& inPiece);  GamePiece& getPieceAt(int x, int y);  const GamePiece& getPieceAt(int x, int y) const;  int getHeight() const { return mHeight; }  int getWidth() const { return mWidth; }  static const int kDefaultWidth = 10;  static const int kDefaultHeight = 10; protected:  void copyFrom(const GameBoard& src);  // objects dynamically allocate space for the game pieces.  GamePiece** mCells;  int mWidth, mHeight;};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?