I have multidimensional array in my class
class Matrix {
double **matrix;
Matrix(int m, int n) : n(n), m(m) {
for (int y = 0; y < n; y++) {
matrix[y] = new double[m];
for (int x = 0; x < m; x++) {
matrix[y][x] = 0;
}
}
}
...
}
Now I want to create getter which works as:
Matrix matrix(5,5);
cout << matrix[3][3];
I'm looking for any idea how to do it in any c++ standard.
Pseudocode:
double operator[][](int a, int b){
...
}
Is it possible?