March 29th, 2010, 01:58 PM
When the Matrix object is const, or when you are accessing the Matrix object through a const reference or a pointer to a const Matrix.
March 29th, 2010, 01:33 PM
Yeah, though it may be better to have the const version return a const reference.
March 29th, 2010, 12:47 PM
Notice that there are two versions of operator().
March 29th, 2010, 10:20 AM
It sounds like you need to const overload operator(), i.e.,
float& Matrix::operator()(const int nRow, const int nCol)
{
return m_pfMatrix[nRow * m_nColCount + nCol];
}
const float&...
March 29th, 2010, 08:11 AM
Your copy constructor and copy assignment operator should have the parameter as const Matrix&. After all, it should make sense to copy a matrix that is constant.
I notice that the copy assignment...
March 29th, 2010, 02:25 AM
That does not really make sense. The destructor will not normally be called from the constructor.
On a hunch: did you implement the copy constructor and copy assignment operator?