title: How to publicly inherit from a base class but make some of public methods from the base class private in the derived class?
body: <p>For example, class <code>Base</code> has two public methods: <code>foo()</code> and <code>bar()</code>. Class <code>Derived</code> is inherited from class <code>Base</code>. In class <code>Derived</code>, I want to make <code>foo()</code> public but <code>bar()</code> private. Is the following code the correct and natural way to do this?</p>
  
  <pre><code>class Base {
     public:
       void foo();
       void bar();
  };
  
  class Derived : public Base {
     private:
       void bar();
  };
  </code></pre>