I have a vector list with "registered" classes.
main.cpp
// main.cpp:
// from namespace::class3
bool successfulregistered = RegisterComponents(vector<CustomNamespace::class1,CustomNamespace::class2>);
class3.h
// in class3
private:
vector<CustomNamespace> Objectinstance;
public:
bool RegisterComponents(vector<CustomNamespace>& RegisterComponents);
class3.cpp
// implementation
bool class3::RegisterComponents(vector<CustomNamespace>& RegisterComponents)
{
for(int i = 0; i < RegisterComponents.end(); i++)
{
class3::Objectinstance->iterator(*RegisterComponents);
// and then some checks
}
}
Now I like to gather access to the classes and created object instances to call methods:
void class3::startserver(void)
{
for(auto i = Objectinstance.begin(); i != Objectinstance.end(); i++)
{
/* How can I create the objects from the vector list with
their classes and call the specific constructor? */
/* i == CustomNamespace::class1 */
}
}
class1.h
ConfigWatchdog(string &SetJSONFile, const char &cJSONRoot);
class2.h
ServerNetworking(unit& setIPAddress, ...);