I have class CMatrix, where is \"double pointer\" to array of values.
class CMatrix {
public:
int rows, cols;
int **arr;
};
I simpl
You can do it by overloading operator[]
to return an int*
, which is then indexed by the second application of []
. Instead of int*
you could also return another class representing a row, whose operator[]
gives access to individual elements of the row.
Essentially, subsequent applications of operator[] work on the result of the previous application.