title: undefined reference to `vtable for ' namespace inheritance undefined reference to `typeinfo for
body: <p>I have such error messages while compiling my (simple) code:</p>
  
  <pre><code>||=== Build: Release in zad12 (compiler: GNU GCC Compiler) ===|
  obj/Release/Section.o||In function `MyFigures::Section::Section()':|
  Section.cpp|| undefined reference to `vtable for MyFigures::Figure'|
  obj/Release/Section.o||In function `MyFigures::Section::Section(Point, Point)':|
  Section.cpp|| undefined reference to `vtable for MyFigures::Figure'|
  obj/Release/Section.o||In function `MyFigures::Section::~Section()':|
  Section.cpp|| undefined reference to `vtable for MyFigures::Figure'|
  Section.cpp|| undefined reference to `vtable for MyFigures::Figure'|
  obj/Release/Section.o:(.rodata._ZTIN10MyFigures7SectionE[_ZTIN10MyFigures7SectionE]+0x10)||undefined reference to `typeinfo for MyFigures::Figure'|
  ||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
  </code></pre>
  
  <p>And the code:</p>
  
  <pre><code>#ifndef _FIGURE_H_
  #define _FIGURE_H_
  
  namespace MyFigures
  {
  class Figure
  {
      public:
  
          Figure(){}
           ~Figure(){}
  
          virtual void draw();
          virtual void move();
          virtual void scale(double s);
  };
  }
  #endif
  
  #ifndef _Section_H_
  #define _Section_H_
  
  #include "figure.h"
  #include "point.h"
  #include &lt;exception&gt;
  
  namespace MyFigures
  {
  
  class Section : public Figure
  {
  public:
      class badsection : public std::exception
      {
      public:
          const char * what() const throw()
          {
              return "error";
          }
      };
  
      Section();
      Section(Point start, Point end);
      void draw();
      void move();
      void scale(double s);
      ~Section();
  
  private:
  
      Point start;
      Point end;
  };
  
  }
  
  #endif
  
  #include "section.h"
  
  namespace MyFigures
  {
  
  Section::Section()
  {
  }
  
  Section::Section(Point start, Point end)
  {
      if(start == end)
          throw badsection();
  }
  
  void Section::draw() {}
  void Section::move() {}
  void Section::scale(double s) {}
  Section::~Section() {}
  
  }
  
  #ifndef _Point_H_
  #define _Point_H_
  
  class Point
  {
      private:
  
          double x,y;
  
      public:
  
          Point();
          ~Point();
          Point(double xx);
          Point(double xx, double yy);
  
          Point&amp; operator=(const Point&amp; p);
          bool operator==(const Point&amp; p);
  
  };
  
  #endif
  
  #include "point.h"
  
  Point::Point()
  {
      x = 0;
      y = 0;
  }
  
  Point::Point(double xx)
  {
      x = xx;
      y = 0;
  }
  
  Point::Point(double xx=0, double yy=0)
  {
      x = xx;
      y = yy;
  }
  
  Point::~Point()
  {
  }
  
  Point&amp; Point::operator=(const Point&amp; p)
  {
      x = p.x;
      y = p.y;
      return *this;
  }
  
  bool Point::operator==(const Point&amp; p)
  {
      return (x == p.x) &amp;&amp; (y == p.y);
  }
  </code></pre>
  
  <p>I tried to make the destructor in <code>Figure</code> class as virtual, but no effect (errors remain).</p>