The class CTestF
{
Protected:
Bool F1 (int a, int b);
Bool Test (int m, int n, bool pf (*) (int, int));
Void the Get ();
};
Bool CTestF: : F1 (int a, int b)
{
If (a> B) return true;
The else return false;
}
Bool CTestF: : Test (int m, int n, bool pf (*) (int, int))
{
Return pf (m, n);
}
Void CTestF: : Get ()
{
Int t=10;
Int h=20;
The Test (t, h, F1);//here hint F1 error: bool (TestF: : *) (int a, int b) "type of real participation" bool (*) (int, int) "type parameter is not compatible with
//error C3867 TestF: : "F1" : nonstandard grammar; Please use "& amp;" To create a pointer to member
//and use & amp; F1 also prompt error!
}
-- -- -- -- -- -- -- -- -- -- teach online urgent warrior!!!!!!!!!!!!!!!!!!!
CodePudding user response:
//if you don't define class, there is no issueInt T1 (int a, int b)
{
Return a + b;
}
Int TF (int m, int n, int (* pT) (int, int))
{
Return pT (m, n);
}
Int GT ()
{
Return TF (10, 20, T1);
}