title: how to use use properly in std:ostream& member, while "this" is a const?
body: <p>I have a class named "Subscriber" , which is inherited from a class 
  named "Client", which contains the following lines of code , in "protected" :</p>
  
  <pre><code>std::ostream&amp; messagesSink;
  
  std::ostream&amp;  getMessagesSink() {
      return messagesSink;
  }
  </code></pre>
  
  <p>(messagesSink is initialized in the constructor of Subscribers)</p>
  
  <p>and there is the following function-member in "subscriber" : </p>
  
  <pre><code>virtual void recieveMessage(const std::string&amp; message ,
          const Topic&amp; topic,
          const Client&amp; client) const {
      messagesSink &lt;&lt; "Topic: "&lt;&lt; topic
              &lt;&lt; ". Sender: #" &lt;&lt; client.getId() &lt;&lt; ". Reciver: #"
              &lt;&lt; getId() &lt;&lt; ".Message: " &lt;&lt; message;
  }
  </code></pre>
  
  <p>the problem goes like this:in his current state, the code has no compilation errors, but if I replace the use of the member messagesSink in the function getMessagesSink(), as the code below, compilation errors appears:</p>
  
  <pre><code>virtual void recieveMessage(const std::string&amp; message ,
          const Topic&amp; topic,
          const Client&amp; client) const {
      getMessagesSink() &lt;&lt; "Topic: "&lt;&lt; topic
              &lt;&lt; ". Sender: #" &lt;&lt; client.getId() &lt;&lt; ". Reciver: #"
              &lt;&lt; getId() &lt;&lt; ".Message: " &lt;&lt; message;
  }
  </code></pre>
  
  <p>my questions are:</p>
  
  <p>1) what is the diffrence between before and after?</p>
  
  <p>2) how to use properly the refrence to std::ostream ,while in a function that keeps "this" as a const?</p>