#include <string>
class Object {
public:
virtual std::string ToString() const = 0;
virtual ~Object() {}
};
class SubFactory : public Object {
public:
explicit ObjIns(const std::string& class_id):
callPhrase(class_id) {}
std::string ToString() const override {
return callPhrase;
}
private:
std::string callPhrase;
};
class Factory {
public:
Factory() {}
Object* Create(const std::string& class_id) {
return new SubFactory(class_id);
}
void Register(const std::string& class_id, Object* (*func)()) {}
};