Ask Function problem?thanks
<<<<<<<<<<Class.h>>>>>>>>>>

#pragma once
class Class
{
public:
    int get_return(int a,int b,int (*compare)());
    int Rxgmoral(int a,int b);
    void Fun();
};

<<<<<<<<<Class.Cpp>>>>>>>>

#include "Stdafx.h"
#include "Class.h"
int Class::get_return(int a,int b,int(* compare)())
{
    return (compare(a,b));
}
int Class::Rxgmoral(int a, int b)
{
    return a+b;
}
void Class::Fun()
{
    int a;
    a=get_return(1,2,&Rxgmoral);
}
error:
e:\mystudio\project\test\test\class.cpp(6) : error C2197: 'int (__cdecl *)(void)' : too many arguments for call
e:\mystudio\project\test\test\class.cpp(17) : error C2276: '&' : illegal operation on bound member function expression

thanks:)

try this
<<<<<<<<<<Class.h>>>>>>>>>>

#pragma once
class Class
{
public:
    int get_return(int a,int b,int (*compare)(int, int));
    int Rxgmoral(int a,int b);
    void Fun();
};

<<<<<<<<<Class.Cpp>>>>>>>>

#include "Stdafx.h"
#include "Class.h"
int Class::get_return(int a,int b,int(* compare)(int, int))
{
    return (compare(a,b));
}
int Class::Rxgmoral(int a, int b)
{
    return a+b;
}
void Class::Fun()
{
    int a;
    a=get_return(1,2,Rxgmoral);
}

Missed another one. You can't call non-static member functions like that. So change it to static.
<<<<<<<<<<Class.h>>>>>>>>>>

#pragma once
class Class
{
public:
    int get_return(int a,int b,int (*compare)(int, int));
    static int Rxgmoral(int a,int b);
    void Fun();
};

<<<<<<<<<Class.Cpp>>>>>>>>

#include "Stdafx.h"
#include "Class.h"
int Class::get_return(int a,int b,int(* compare)(int, int))
{
    return (compare(a,b));
}
int Class::Rxgmoral(int a, int b)
{
    return a+b;
}
void Class::Fun()
{
    int a;
    a=get_return(1,2,Class::Rxgmoral);
}
This article has been dead for over six months. Start a new discussion instead.