title: How to encapulate user function from subclass in C++
body: <p>For explain my problem, I wrote some example.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>class Product {
  public:
    Product(Module&amp; module, Config module_cfg) : module_(module) {
      module_.SetConfig(module_cfg);
    }
  
    void Work() {
      module_.Work();
    }
  
  private:
    Module&amp; module_;
  };
  
  class Module {
  public:
    void SetConfig(Config cfg) {
      cfg_ = cfg;
    }
  
    virtual void Work() = 0;
  
  protected:
    Config cfg_;
  };
  
  
  class ModuleA : public Module {
    void Work() override {
      cfg_.GetSomething(); // use config
    }
  };
  </code></pre>
  
  <ol>
  <li>"Product" has a "Module" as composition.</li>
  <li>"Module" works with "Config".</li>
  <li>"Module" is parent class of "ModuleA".</li>
  </ol>
  
  <p>I want to encapsulate "SetConfig()" method from "ModuleA"!!</p>
  
  <p>On the other words, is there way to hide user functions from an inherited class?</p>