// grid.h #ifndef GRID_H #define GRID_H #include #include using namespace std; class Grid { public: Grid(int r = 10, int c = 24); // OCF stuff Grid(const Grid& g) { copy(g); } virtual ~Grid() { free(); } Grid& operator=(const Grid& g); virtual void plot(int row, int col, char c = '*') { grid[row % rowSize][col % colSize] = c; // wrap around } virtual void show(ostream& os = cout); virtual void hPlot(int row, int col, const string& s); virtual void vPlot(int row, int col, const string& s); virtual void plotLine(int xstart, int ystart, int xend, int yend, char c = '*'); virtual void clear(char c = ' '); virtual int getColGetSize() { return colSize; } virtual int getRowGetSize() { return rowSize; } virtual char getChar(int row, int col) { return grid[row % rowSize][col % colSize]; } private: int rowSize, colSize; char** grid; virtual void free(); virtual void copy(const Grid& g); }; #endif