int main() {
int num = 5;
int *(*pSquare)(int &a);
int (*pSquare1)(int &a);
pSquare = square;
pSquare1 = square1;
cout << "invoke square:" << endl;
cout << *(*pSquare)(num) << endl;
cout << endl;
cout << "invoke square1:" << endl;
cout << (*pSquare1)(num) << endl;
cout << endl;
system("pause");
return 0;
}
对比一下pSquare和pSquare1我们会发现区别,pSquare是一个指向指针的指针,而pSquare1是一个指向函数的指针,所以pSquare与square搭配,pSquare1与square1搭配。