What executes earlier, return or ++?
<pre><code>class x
{
 public:
  int y;
  x&amp; operator++(int);

};
</code></pre>

<p>I want the foo(), that works like:</p>

<pre><code>int&amp; foo()
{
  int&amp; ret_val = x.y;
  x++;
  return ret_val;
}
</code></pre>

<p>but looks like:</p>

<pre><code>int&amp; foo()
{
  return (x++).y;
}
</code></pre>

<p>Is this possible? What is executed earlier, return or ++?</p>

<p>ok, thx for your answers. </p>

<p>"rather a copy of the object in the state prior to the increment (i.e.- your x&amp; operator++(int) doesnt follow the convention)"
Can I write operator++(int) follow the convention? and how do it be written?</p>

<p>Then can I write function like this:</p>

<pre><code>int foo() {return (x++).y;}
</code></pre>
