Can someone explain to me what each const is for in this function prototype?Code:const Matrix Matrix::operator+(const Matrix& rhs) const;
Thanks.
Pier.
Can someone explain to me what each const is for in this function prototype?Code:const Matrix Matrix::operator+(const Matrix& rhs) const;
Thanks.
Pier.
Well, I thought it was a simple question too until I noticed the , then I got all confused. My compiler wont even accept that. :<
AIM: MarderIII
The first const means it returns a constant matrix, the one in the parenthesis means that the matrix passed will remain constant throughout the function, and the one at the end means that the class itself will not be changed throughout the function.