i want to have a class member which is a pointer to undefined typical function .
the function must be performed by user. the user must pass the function as a parameter to class constructor.
the function is called in the scope of class methodes.
can i do these tasks like this ?
class MyClss
{
private:
bool (*f)();
public:
MyClss(bool (*fp)());
void MyMethod();
}
MyClss::MyClss(bool (*fp)())
{
f = fp;
}
void MyClss::MyMethod()
{
// do tasks
if(f())
{
// do tasks
}
}