Relevance of const return type in NRVO cases
<p>This is a follow up question from <a href="http://stackoverflow.com/questions/10941730/calling-constructor-in-return-statement">Calling constructor in return statement</a>.</p>

<p>This a operator overload fun in a class.</p>

<pre><code>const Integer operator+(const Integer&amp; IntObject)
{
    cout &lt;&lt; "Data : " &lt;&lt; this-&gt;data &lt;&lt; endl;
    return Integer(this-&gt;data + IntObject.data); 
}
</code></pre>

<p>What is the relevance of const in the return type for such functions?   </p>

<pre><code>int main()
{
    Integer A(1); //Create 2 object of class Integer

    Integer B(2);

    const Integer C = A + B;  //This will work

    Integer D = A + B;        //This will also work

    fun(A + B);               //Will work
}

void fun(Integer F) {}
</code></pre>

<p>This is a case temporaries are not created during return step due to NRVO. The object to be returned is directly constructed on the callee's address. </p>
