Matrix and reference
The Matrix
class is used when storing the cells of spreadsheet, and the Reference
class is used when accessing cells in the spreadsheet.
The reference class
The Reference
class holds the row and column of a cell in the Matrix
class, as shown in the next section:
Reference.h
namespace SmallWindows { class Reference; extern const Reference ZeroReference; class Reference { public:
The default constructor initializes the row and column to zero. A reference can be initialized by and assigned to another reference:
Reference(); Reference(int row, int col); Reference(const Reference& ref); Reference& operator=(const Reference& ref);
The compare operators first compare the rows. If they are equal, the columns are then compared:
friend bool operator==(const Reference& ref1, const Reference& ref2); friend bool operator...