#ifndef SHAPEFACTORY_H_
#define SHAPEFACTORY_H_
#include <istream>
#include <map>
#include <string>
#include "shape.h"
typedef Shape *(createShapeFunction)(void);
/* thrown when a shape cannot be read from a stream */
class WrongFormatException { };
class ShapeFactory {
public:
static void registerFunction(const std::string &string, const createShapeFunction *shapeFunction);
static Shape *createShape(const std::string &string);
static Shape *createShape(std::istream &ins);
private:
std::map<std::string, createShapeFunction *> creationFunctions;
ShapeFactory();
static ShapeFactory *getShapeFactory();
};
#endif
这是标题,我还没有实现任何方法,但我收到以下警告:
Qualifier on function type 'createShapeFunction' (aka 'Shape *()') has unspecified behavior
ps:这个标题是我老师给的,作为作业我必须实现这些方法