参见<<c++ primer>> p237页
bool (*pf)(const string &, const string &);
typedef bool (*cmpFcn) (const string &,const string &);//表示cmpFcn是一种指向函数的指针类型的名字
bool lengthCompare(const string &,const string &){return 0;}
int main()
{
cmpFcn pf1 = 0;//函数指针初始化为0表示该指针不指向任何函数
cmpFcn pf2 = lengthCompare;
pf2 = pf1;
pf1 = lengthCompare;
pf2 = &lengthCompare;//在函数名上应用取地址操作符 等效于 直接引用函数名
lengthCompare("hi","bye");
(*pf2)("hi","bye");
pf1("hi","bye");//可以不需要使用解引用操作符,直接通过指针调用函数
return 0;
}
void useBigger1(const string &,const string &,bool(const string&,const string&) );//函数指针作形参的两种形式
void useBigger2(const string &,const string &,bool (*)(const string&,const string&) );