Hello, I'm trying to create a matrix that dynamically defines the rows and columns.. Now, everything is fine, apart from when I include a function to output the 2D array..

The error:

Matrix.cpp:20: error: invalid types ‘double[int]’ for array subscript

...

The code is:

Matrix.cpp

```
#include <iostream>
#include "Matrix.h"
using namespace std;
Matrix::Matrix(){};
Matrix::Matrix(double M, double N)
{
rows = M;
columns = N;
matrix = new double[(unsigned int)rows*(unsigned int)columns];
}
double Matrix::getRead()
{
for (int i=0, j=0; (i < rows, j < columns); i++, j++)
{
cout << matrix[i][j];
}
}
```

Matrix.h

```
#ifndef _Matrix_h
#define _Matrix_h
#include <vector>
using namespace std;
class Matrix
{
public:
Matrix(); // Constructor
Matrix(const double M, const double N);
double getRead();
protected:
double* matrix;
int rows;
int columns;
};
#endif
```

Any ideas? Thanks =)