c++ - How do I typedef a function pointer with the C++11 using syntax? - Stack Overflow
1#include <iostream>
2
3class A {
4public:
5 void display() { std::cout << "A display" << std::endl; }
6};
7
8int main() {
9 typedef void (A::*PF1)();
10 PF1 pf1 = &A::display;
11 A a1;
12 (a1.*pf1)();
13
14 using PF2 = void (A::*)();
15 PF2 pf2 = &A::display;
16 A* a2 = new A;
17 (a2->*pf2)();
18 return 0;
19}
20
21// output:
22// A display
23// A display