I have seen all the other threads but I can't get mine to work. I am trying to multiply two matrices with overloading operators.
mat[SIZE][SIZE] is my private variable
SIZE is initalized to 2 for now
Code:Matrix & Matrix::operator *= ( const Matrix & rhs ) { Matrix temp; for(int i = 0; r < SIZE; ++i) { for(int j = 0; j < SIZE; ++j) { for(int k = 0; k < SIZE; ++k) { mat[i][j] += mat[i][k] * rhs.mat[k][j]; } } } return * this; } Matrix Matrix::operator * ( const Matrix & rhs ) const { Matrix ret_val (* this); ret_val *= rhs; return ret_val; }



LinkBack URL
About LinkBacks


