I need to store pointers to class methods, and then call these methods.
Here is a refined example:
class Test { int testmethod(int value) { return value; } int (Test::*func)(int) = &Test::testmethod; }; int main() { Test test; Test* testpointer = &test; (testpointer->*func)(3); return 0; }
It seems that the syntax is exactly the same as that one, but the compiler swears:
maip.cpp: В функции «int main()»: maip.cpp:35:17: ошибка: нет декларации «func» в этой области видимости (testpointer->*func)(3); ^
I am using gcc 5.3.0