Three "const"s in const func (const scalar& a) const, why?
<p>newbie here!</p>

<p>I am reading a code and I see the author frequently writing a member function as </p>

<pre><code>const int func (const scalar&amp; a) const
// etc
</code></pre>

<p>You see there are three const here, now I understand the middle one, const scalar&amp; a, that aims to not change the object a, but what about the other two const?</p>

<p>Is it a good habit that I should do this all the time, to protect blahblah unchanged?</p>

<p>Thanks a lot!</p>
