class TDigitalIntMatrix
{
public:
explicit TDigitalIntMatrix(int rows = 2, int columns = 2);
int matrixCell(int row, int column); //возвращает значение ячейки массива M[row][column]
int matrixRowsValue(); //возвращает количество строк в массиве
int matrixColumnsValue(); //возвращает количество столбцов в массиве
TDigitalIntMatrix operator +(TDigitalIntMatrix B);
~TDigitalIntMatrix();
private:
int** M;
int r, c;
signals:
public slots:
};
TDigitalIntMatrix TDigitalIntMatrix::operator +(TDigitalIntMatrix B)
{
int columns = B.matrixColumnsValue(),
rows = B.matrixRowsValue();
TDigitalIntMatrix Res(rows,columns); //= new TDigitalIntMatrix(rows, columns);
for(int i=0;i<columns;i++) {
for(int j=0;j<rows;j++) {
Res.matrixCell(i,j) = this->matrixCell(i,j) + B.matrixCell(i,j);
}
}
return Res;
}
На строке Res.matrixCell(i,j) = this->matrixCell(i,j) + B.matrixCell(i,j);
выдает lvalue required as left operand of assignment. Как избавиться? Или нужно по-другому перегружать?