I would like to have a private static function pointer in my class. Basically, it will look like this:
class X {
private:
static int (*staticFunc)(const X&);
...
public:
void f();
};
void X::f()
{
staticFunc(*this);
}
This gives me the error "unresolved external character". I know that static members must also be initialized in .cpp, I tried this:
int (X::*staticFunc)(const X&) = NULL;
but it gives me the error of "initializing the function". This gives me a more ugly error if I try to initialize it with an existing function. Without "= NULL", I get the same error.
Thank.
source
share