How can I use void printMatrix( ostream& os = cout ) const?
<p>I am trying to learn C++, and I've got a task, to do some printing with this function, and I don't understand how to use the ostream. Can anyone help me please? </p>

<pre><code>    void Matrix::printMatrix( ostream&amp; os = cout ) const{
    for(int i=0; i&lt;n; i++)
      for(int j=0; i&lt;m; j++)
        os&lt;&lt;elements[i][j]&lt;&lt;"\n";
    }
</code></pre>

<p>I've tried to do this, but it threw me some errors, and I don't know how to handle this.
The errors: </p>

<p>Matrix.cpp:47:48: error: default argument given for parameter 1 of ‘void Matrix::printMatrix(std::ostream&amp;) const’ [-fpermissive]
In file included from Matrix.cpp:8:0:
Matrix.h:25:10: error: after previous specification in ‘void Matrix::printMatrix(std::ostream&amp;) const’ [-fpermissive]</p>
