title: If a private virtual function is overridden as a public function in the derived class, what are the problems?
body: <pre><code>using namespace std;
  #include &lt;cstdio&gt;
  #include &lt;iostream&gt;
  
  class One{
      private:
          virtual void func(){
              cout&lt;&lt;"bark!"&lt;&lt;endl;
          }
  };
  
  class Two: public One{
      public:
          void func(){
              cout&lt;&lt;"two!"&lt;&lt;endl;
          }
  };
  
  int main(){
      One *o = new Two();
      o-&gt;func();
  }
  </code></pre>
  
  <p>Why is there an error on <code>o-&gt;func()</code>?</p>
  
  <p>I don't know the mechanism behind it... In my opinion, <code>o-&gt;func()</code> should call the <code>func()</code> in the derived class, which is public, so there wouldn't be problems, but it says:</p>
  
  <pre><code> error: ‘virtual void One::func()’ is private
  </code></pre>