fcn1()
is not a plain function but a member function. You can't use an ordinary function pointer to store a pointer to it, because this doesn't provide enough information: what should this
be set to when the function is called?
You need to use a member function pointer instead:
void (A::*pfcn1)(double*, double*, int, int, void*) = &A::fcn1;
If you have an object a
of type A
, you can later call it using:
(a.*pfcn1)(&somedouble, &somedouble, 42, 69, NULL);
If you have a pointer pa
to an object of type A
, you can later call it using:
(pa->*pfcn1)(&somedouble, &somedouble, 42, 69, NULL);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…