-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等等等等的无效初始化...