pass by const reference of class
<pre><code>void foo(const ClassName &amp;name)
{
    ...
}
</code></pre>

<p>How can I access the method of class instance name?</p>

<p><code>name.method()</code> didn't work. then I tried:</p>

<pre><code>void foo(const ClassName &amp;name)
{
    ClassName temp = name;
    ... ....
}
</code></pre>

<p>I can use temp.method, but after foo was executed, the original name screwed up, any idea?
BTW, the member variable of name didn't screwed up, but it was the member variable of subclass of class screwed up.</p>
