不小心翻了一下c++程序设计语言一道函数引用的练习题,函数引用有什么价值? 没想出来。记一下,先准备明天的面试吧,hp,加油! :)
#include <stdio.h>
typedef int(&A)(int);
typedef int(*B)(int);
int test1(int a)
{
printf("test1 %d\n",a);
return a;
}
int main()
{
int i;
A aa = *******test1;
//A aaa = &test1; //err
B bb = ********test1;
B bbb = &test1;
aa(i);
bb(i);
}