c++中函数看成对象来传递,相似c#中的指针操做如:ios
#include <iostream> using namespace std; int tst(int a){ cout<<a<<endl; return 5; } //类型 +(* +变量名)(+ 函数须要参数) void BigTest(int (* test)(int a)){ int c= test(5); } int main() { //传递进来同样的函数 BigTest(tst); }