C++ operator overloading doubt
- by avd
I have a code base, in which for Matrix class, these two definitions are there for () operator:
template <class T> T& Matrix<T>::operator() (unsigned row, unsigned col)
{
......
}
template <class T> T Matrix<T>::operator() (unsigned row, unsigned col) const
{
......
}
One thing I understand is that the second one does not return the reference but what does const mean in the second declaration. Also which function is called when I do say mat(i,j)