Calling C++ member function pointer from a struct
问题 I have found information on calling C++ member function pointers and calling pointers in structs, but I need to call a member function pointer that exists inside of a structure, and I have not been able to get the syntax correct. I have the following snippet inside a method in class MyClass: void MyClass::run() { struct { int (MyClass::*command)(int a, int b); int id; } functionMap[] = { {&MyClass::commandRead, 1}, {&MyClass::commandWrite, 2}, }; (functionMap[0].MyClass::*command)(x, y); }