1
class matrix
{
    int r,c;
public:
    matrix(int r , int c)
    {
        this->r=r;
        this->c=c;
    }
};

I have this class named as matrix. Where I need to create a matrix by taking the size of the row and column and then overload [] in such a way that when used with ob ( object of the matrix class)

like ob[i][j] to interchange the row and column of the matrix. (i size of column and j size of row)

How can I do the task?

L_J
  • 2,351
  • 10
  • 23
  • 28
  • You would need to do something like in this [answer](https://stackoverflow.com/a/6969905/1960455) to the question [operator\[\]\[\] overload](https://stackoverflow.com/questions/6969881) – t.niese Dec 25 '19 at 15:16
  • [C++ \[\] array operator with multiple arguments?](https://stackoverflow.com/questions/1936399/c-array-operator-with-multiple-arguments) – t.niese Dec 25 '19 at 15:18
  • There are in general many ways how you could implement a matrix, and depending on that the solution how to implement that will vary. – t.niese Dec 25 '19 at 15:19

0 Answers0