c ++用using和typedef定义函数指针:
#include <iostream>
void f(int a);//调用的函数
typedef void(*P)(int a);//可以把P理解为一个类
using P = void(*)(int a);//等价上一条
using namespace std;
int main()
{
P a = f;
a(32);
return 0;
}
void f(int a)
{
cout << a << endl;
}