title: Trying to store a pointer to an abstract class in a map C++
body: <p>I have a program that stores a pointer to an abstract class into a map, so that I can use the data from the map to make calls to the concrete classes of the abstract class (using the factory method).</p>
  
  <p>It needs to store a pointer since the class is abstract, but the problem is that when I make is a pointer, I get the error </p>
  
  <blockquote>
    <p>No matching member function to call 'insert'</p>
  </blockquote>
  
  <p>My code looks as follows:</p>
  
  <h2>Shape Factory Class Header</h2>
  
  <pre><code>#ifndef ShapeFactoryManager_hpp
  #define ShapeFactoryManager_hpp
  
  #include &lt;stdio.h&gt;
  #include "ShapeFactory.h"
  #include "CircleFactory.h"
  #include "PolygonFactory.h"
  #include "LineFactory.h"
  #include &lt;map&gt;
  
  class ShapeFactoryManager
  {
  public:
      ShapeFactoryManager();
      const static ShapeFactoryManager&amp; getInstance();
      ShapeFactory createFactory(unsigned long shapeID) const;
      bool RegisterShape(unsigned long id, ShapeFactory* factory) const;
  
  private:
      const std::map&lt;unsigned long, ShapeFactory*&gt;registrationTable;
  };
  
  #endif /* ShapeFactoryManager_hpp */
  </code></pre>
  
  <h2>Shape Factory Manager .cpp</h2>
  
  <pre><code>bool ShapeFactoryManager::RegisterShape(unsigned long id, ShapeFactory* factory) const
  {
      registrationTable.insert(std::make_pair(id, factory));
      return true;
  }
  </code></pre>
  
  <p>The error occurs at:</p>
  
  <pre><code>registrationTable.insert(std::make_pair(id, factory)); 
  </code></pre>