-4
錯誤我試圖超載< <並使用標準'cout < < m1;'打印類型線。<< <<超載
// Output
void Matrix::print(ostream& out) const
{
for(int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
out << setw(4) << (*this)(i,j);
out << endl;
}
}
// Overloaded stream insertion operator
ostream& operator<<(ostream& out, const Matrix& x) // display the matrix
{
return x.print(out);
}
我得到非const等等等等的無效初始化...