@featips,
The code posted by Joeman is correct as far as logic is concerned. It's entirely upto you how you want to go on with it.
In a 2-D array '[]' returns the element at that index (row or column). So subsequent calls to '[]' ends
up fetching the data itself. Notice that there are no separate overloads for '[]' for 1D, 2D, 3D, etc. arrays.
Similarly the operator '[]' in case of your class can be made to return a row/column/1-D array too which with subsequent calls will finally fetch you the data.

Regards,
Nisheeth Barthwal