title: C++ Multiple inheritance with interfaces?
body: <p>Greetings all,</p>
  
  <p>I come from Java background and I am having difficulty with multiple inheritance.</p>
  
  <p>I have an interface called IView which has init() method.I want to derive a new class called PlaneViewer implementing above interface and extend another class. (QWidget).</p>
  
  <p>My implementation is as:</p>
  
  <p><strong>IViwer.h (only Header file , no CPP file) :</strong></p>
  
  <pre><code>#ifndef IVIEWER_H_
  #define IVIEWER_H_
  
  class IViewer
  {
  public:
    //IViewer();
    ///virtual
    //~IViewer();
    virtual void init()=0;
  };
  
  #endif /* IVIEWER_H_ */
  </code></pre>
  
  <p>My derived class.</p>
  
  <p><strong>PlaneViewer.h</strong></p>
  
  <pre><code>#ifndef PLANEVIEWER_H
  #define PLANEVIEWER_H
  
  #include &lt;QtGui/QWidget&gt;
  #include "ui_planeviewer.h"
  #include "IViewer.h"
  class PlaneViewer : public QWidget , public IViewer
  {
      Q_OBJECT
  
  public:
      PlaneViewer(QWidget *parent = 0);
      ~PlaneViewer();
      void init(); //do I have to define here also ?
  
  private:
      Ui::PlaneViewerClass ui;
  };
  
  #endif // PLANEVIEWER_H
  </code></pre>
  
  <p><strong>PlaneViewer.cpp</strong></p>
  
  <pre><code>#include "planeviewer.h"
  
  PlaneViewer::PlaneViewer(QWidget *parent)
      : QWidget(parent)
  {
      ui.setupUi(this);
  }
  
  PlaneViewer::~PlaneViewer()
  {
  
  }
  
  void PlaneViewer::init(){
  
  }
  </code></pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Is it necessary to declare method init() in PlaneViewer interface also , because it is already defined in IView?</li>
  </ol>
  
  <p>2.I cannot complie above code ,give error :</p>
  
  <p>PlaneViewer]+0x28): undefined reference to `typeinfo for IViewer'
  collect2: ld returned 1 exit status</p>
  
  <p>Do I have to have implementation for IView in CPP file (because all I want is an interface,not as implementation) ?</p>