Original Post
Say I had a simple class such as this:
class matrix
{
public:
matrix(int rows, int cols); //allocate a rows x cols matrix
//etc, etc....
private:
int **theMatrix; //will be allocated dynamically
int rows;
int cols;
};
How do you overload the [] operator to properly do this:
matrix someMatrix(5,5); //make a 5 x 5 matrix
//do whatever......
cout << someMatrix[2][4] << endl;
I know how to do it with a single dimension array, but how do you do this with a two dimension array?
thanks,
skitzo_smurf
Edited by - skitzo_smurf on 7/11/00 4:37:20 PM
Edited by - skitzo_smurf on 7/11/00 5:45:21 PM