I am trying to implement a Matrix class in c++. I am having problems trying to get the assignment operator to work. At this point I am lost. The issue is that I am getting an error saying that "vector subscript is out of range". If I take this code away
this->size = A.size;
int size; //size of matrix
Matrix& Matrix::operator=(const Matrix& A)
if (this == &A)
this->size = A.size; // this is causing problems
When you assign one matrix to another, you not only need to change the size data member, but also need to change the other data members such as resizing the vector of doubles.