When defining a member function pointer that points to a function inherited privately from a base class, how would you declare it?
eg..
// class B defined here
class A; //forward dec
typedef void (B::*fnc_ptr)(); // This? or..
typedef void (A::*fnc_ptr)(); // this...?
class A: private B{
public:
A(): ptr(0){};
~A(){};
using B::fnc;
void setandcall(){
ptr = &fnc;
(*ptr)();
}
fnc_ptr ptr;
};
You have not attached the error you are getting. I think your real error might be that both
of your choices don’t have a return type specified.
That being said both of your constructs will work. You problem is that when you invoke a non static member function you need to pass this parameter. The private inheritance only affects consumers of A not A itself.