¡@

Home 

c++ Programming Glossary: register_class

Register an object creator in object factory

http://stackoverflow.com/questions/1310214/register-an-object-creator-in-object-factory

this factory. I use the following macro to do that #define REGISTER_CLASS className interfaceName class className static RegisterClass.. T Usage class IFoo public virtual Do 0 virtual ~IFoo REGISTER_CLASS Foo IFoo virtual Do do something REGISTER_CLASS Bar IFoo virtual.. ~IFoo REGISTER_CLASS Foo IFoo virtual Do do something REGISTER_CLASS Bar IFoo virtual Do do something else Classes are defined and..

somehow register my classes in a list

http://stackoverflow.com/questions/1691473/somehow-register-my-classes-in-a-list

MyClasses string name myclasses.push_back name #define REGISTER_CLASS cls static MyClasses myclass_##cls #cls struct XYZ REGISTER_CLASS.. cls static MyClasses myclass_##cls #cls struct XYZ REGISTER_CLASS XYZ The trick here is to make some computation before main is.. called and you can achieve this via global initialization. REGISTER_CLASS cls actually generates code to call the constructor of MyClasses..