title: Storing member function pointers of derived classes in map
body: <p>I am trying to implement a factory for two classes Circle, Square both of which inherits from Shape.</p>
  
  <pre><code>class Shape {
  public: 
      virtual static
      Shape * getInstance() = 0;
  
  };
  
  class Circle : public Shape {        
  public:
      static const std::string type;
  
      Shape * getInstance() {
          return new Circle;
      }
  };
  const std::string Circle::type = "Circle";
  
  class Square : public Shape {        
  public:
      static const std::string type;
  
      Shape * getInstance() {
          return new Square;
      }
  };
  const std::string Square::type = "Square"; 
  </code></pre>
  
  <p>I want to now create a map with key as shape type (string) and value as a function pointer to getInstance() of the corresponding derived class. Is it possible?</p>
  
  <p>Thanks,
  Kiran</p>