title: Should I avoid multiple implementation inheritance?
body: <p>I would like to define interfaces for different properties of my classes that can be accessed from external methods/classes.</p>
  
  <ul>
  <li><p>I use multiple implementation inheritance (= inheritance from concrete classes which opposed to interface inheritance) which is considered a bad practice (<a href="https://stackoverflow.com/a/407928/8044236">point 3 from here</a>).</p></li>
  <li><p>I use inheritance for code reuse. As said <a href="https://isocpp.org/wiki/faq/multiple-inheritance#mi-disciplines" rel="nofollow noreferrer">here</a>, it is better to use composition over inheritance for code reuse. But with composition, all my <code>MyObj1,MyObj2,...,MyObj1000</code> will have the same get and set methods, while I have to reimplement them really rarely.</p></li>
  </ul>
  
  <p>Is this scenario is perfect illustration of situation when multiple implementation inheritance for code reuse is good or this code completely wrong and I should use some clever syntax / patterns to avoid such design? <em>I ask this question because I believe in latter.</em></p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  
  // interface of object with name
  class BaseName {
  public:
      virtual void setName(const std::string&amp; val) { name = val; }
      virtual std::string getName() const { return name; }
  private:
      std::string name;
  };
  
  // user of interface of objects with name
  void nameUser(BaseName* b) {
      std::cout &lt;&lt; b-&gt;getName() &lt;&lt; std::endl;
  }
  
  // interface of object with id
  class BaseID {
  public:
      virtual void setID(int val) { id = val; }
      virtual int getID() const { return id; }
  private:
      int id = 0;
  };
  
  // user of interface of objects with id
  void idUser(BaseID* b) {
      std::cout &lt;&lt; b-&gt;getID() &lt;&lt; std::endl;
  }
  
  class MyObj1 : public BaseID, public BaseName {
  public:
      void setName(const std::string&amp; val) override { 
          /* update internal state that depends on name. this is why "virtual" is required */
          BaseName::setName(val);
      }
  
      /* methods and fields specific to MyObj1 */
  };
  
  // MyObj2,...,MyObj999
  
  class MyObj1000 : public BaseID, public BaseName {
  public:
      /* methods and fields specific to MyObj1000 */
  };
  
  int main() {
      MyObj1 o1;
      o1.setName("xxx");
      o1.setID(18);
  
      MyObj1000 o2;
      o2.setName("yyy");
      o2.setID(-738);
  
      nameUser(&amp;o1);
      nameUser(&amp;o2);
      idUser(&amp;o1);
      idUser(&amp;o2);
  }
  </code></pre>