c++ exception handling pass by reference : thrown address is different from caught address?
<pre><code>#include &lt;iostream&gt;
#include &lt;exception&gt;
using namespace std;


class myexception: public exception
{
  virtual const char* what() const throw()
  {
    return "My exception happened";
  }
};

int main ()
{
  try
  {
    myexception myex;
    printf("addr1:%x\n",&amp;myex);
    throw myex;
  }
  catch (exception&amp; e)
  {
    printf("addr2:%x\n",&amp;e);
    cout &lt;&lt; e.what() &lt;&lt; endl;
  }
  return 0;
}
</code></pre>

<h1>output of this program:</h1>

<pre><code>addr1:6d78c020
addr2:20a1080
My exception happened
</code></pre>

<p>Question: Do you see addr1 and addr2 are different, any idea why?</p>
