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.

Printable View

- 02-14-2003MadStrum!Simple QuestionCode:
`const Matrix Matrix::operator+(const Matrix& rhs) const;`

Thanks.

Pier. - 02-14-2003Noobie
Well, I thought it was a simple question too until I noticed the :o, then I got all confused. My compiler wont even accept that. :<

- 02-14-2003PJYelton
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.