title: Calling member of added classes with multiple inheritance
body: <p>I had 4 classes:</p>
  
  <ul>
  <li>List</li>
  <li>Base </li>
  <li>A</li>
  <li>B</li>
  </ul>
  
  <p>I needed to add a class which extends the work of the classes A and B - L3. Classes NewA and NewB implement the function declared in L3.</p>
  
  <pre><code>class Base
  {
       virtual void foo() = 0;
  }
  
  class A: virtual public Base
  {
       void foo();
  }
  class B: virtual public Base
  {
       void foo();
  }
  
  class L3: virtual public Base
  {
       virtual void bar() = 0;
  }
  class NewA: public A, virtual public L3
  {
       void bar();
  }
  
  class NewB: public B, virtual public L3
  {
       void bar();
  }
  </code></pre>
  
  <p>How can I call function bar() inside List?</p>
  
  <p><strong>UPD</strong></p>
  
  <p>First List contains objects A and B, but now there NewA and NewB</p>
  
  <pre><code>class List
  {
      public:
          void append(Base *sh);
          void next();
          void setBegin();
          Base* curr();
          void out(std::ofstream &amp;ofst);
  
      protected:
          std::list &lt;Base*&gt; container;
          std::list &lt;Base*&gt;::iterator iter;
  }
  
  void List:: next()
  {
      iter++;
  }
  
  void List:: setBegin()
  {
      iter = container.begin();
  }
  
  void List:: append(Base* sh)
  {
      container.push_back(sh);
  }
  
  Base* List::curr()
  {
      return *iter;
  }
  
  void List::out(ofstream &amp;ofst)
  {
      setBegin();
      for (int i=0; i&lt;container.size(); i++)
      {
          cout&lt;&lt;"Out: "&lt;&lt; endl; // I need to call bar() at this line
          next();
      }
  }
  </code></pre>