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 ...

Get C++ Windows Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.