gameboard.h

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

H
36
字号
#include <stdexcept>#include <new>using std::bad_alloc;using std::out_of_range;class GamePiece {};class GameBoard{ public:  GameBoard(int inWidth = kDefaultWidth, int inHeight = kDefaultHeight)    throw(bad_alloc);  GameBoard(const GameBoard& src) throw(bad_alloc);  ~GameBoard() throw();  GameBoard& operator=(const GameBoard& rhs) throw(bad_alloc);  void setPieceAt(int x, int y, const GamePiece& inPiece)    throw(out_of_range);  GamePiece& getPieceAt(int x, int y) throw(out_of_range);  const GamePiece& getPieceAt(int x, int y) const throw(out_of_range);  int getHeight() const throw() { return mHeight; }  int getWidth() const throw() { return mWidth; }  static const int kDefaultWidth = 100;  static const int kDefaultHeight = 100; protected:  void copyFrom(const GameBoard& src) throw(bad_alloc);  GamePiece** mCells;  int mWidth, mHeight;};

⌨️ 快捷键说明

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