Recently, I encountered one thing that I did not understand — pointers to functions of a class. Do they make sense? When are they used? Example:
class ABC { public: void show() { cout << "Hello" << endl; } }; int main() { void(ABC::*point)() = &ABC::show; // указатель на ф-цию класса ABC myClass; (myClass.*point)(); return 0; } Such pointers work only with the object. Isn't it more convenient to call class functions directly?
ABC myClass; myClass.show(); Or
ABC myClass; ABC * point2 = &myClass; point2->show();