#include using namespace MyNamespace; Base::Base(const Registration&) { prototypeList().push_back(this); } Base* Base::make (std::string filename) { std::list::iterator it = prototypeList().begin(); for ( ; it!=prototypeList().end(); ++it ) { if ((*it)->isMine(filename)) (*it)->make(filename); } } Base* Base::clone() { return new Base; } bool Base::isMine(std::string) { return false; } Base::~Base() {} // non-members list& prototypeList() { static list foo; return foo; } namespace { Base Prototype(Registration("Base")); } MyNamespace::Base* God = &Prototype; //------------------- PRIVATE ----------------------------- Base::Base(){} Base::Base(const Base&){} Base& Base::operator=(const Base&){ return *this; }