why I can access private method from outside in C++?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4991267/why-is-it-allowed-to-call-derived-class-private-virtual-method-via-pointer-of-b">Why is it allowed to call derived class&#39; private virtual method via pointer of base class?</a>  </p>
</blockquote>



<p>Recently, I met a strange question, plz refer to following code:</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

class A
{
    public:
        virtual void disp() {
            cout&lt;&lt;"A disp"&lt;&lt;endl;
        }

};

class B : public A
{
    private:
        void disp() {
            cout&lt;&lt;"B disp"&lt;&lt;endl;
        }
};

int main()
{
    A a;
    a.disp();

    A *b = new B();
    b-&gt;disp();
}
</code></pre>

<p>and the output is:</p>

<pre><code>A disp
B disp
</code></pre>

<p>I'm wondering why pointer b can access disp()? It's private! Isn't it?</p>
