I want to take address of a member function in c++.
how to do this.
please suggest me as soon as possible.
how to do this.
please suggest me as soon as possible.
class Example
{
public:
int function(double);
}
int main()
{
// Declare memFunPtr, pointer to a member function
int (Example::*memFunPtr)(double) = &Example::function;
// Use the member function pointer
int result;
double input = 5.0;
Example e;
result = (e.*memFunPtr)(input);
}
class Example typedef int (Example::*MemFunPtr_t)(double); MemFunPtr_t memFunPtr2 = &Example::function;
A obj; cout<<&obj.Display();
Comment