c++ define types/call functions based on configuration-Collection of common programming errors

You can do this but it requires a lot of preparation and prior knowledge. Basically you’d need to create function pointers to all your class methods, those methods would have to have the same signature, and you’d need to hold all of this information in a hashtable. Like this:

class Foo {
public:
    void MyMethod1(int _input);
    void MyMethod2(int _input);
    .
    .
    .
    void MyMethodN(int _input);
};

typedef (Foo::*foo_func)(int);
class Acceptor{
public:
    void Command(Foo &_foo, string _name, int _arg){
        return _foo.*(m_MappedFunctions[ _name ])(_arg);
    }
private:
    unordered_map m_MappedFunctions;
};

where you’ve placed function pointers to all of Foo‘s methods in the hashtable. You see? It’s both inflexible and requires a lot of coordinate between code, configuration file and calling convention.