Hi,
I want to define a callback handler that can take different implementations in the class hierarchy.
Here is the way in which i tried to do , but get a compilation error
I got the Following error in compilation with g++Code:#include <iostream> using namespace std; class A { public: void fun(int){} }; class B: virtual public A { public: void func(int){} }; typedef void(A::*TFunPointer)(int); int main() { A a; B b; A::TFunPointer t = &A::fun; A::TFunPointer t1 = &B::func; }
------klip-------------------
funPointer.cxx: In function `int main()':
funPointer.cxx:24: error: cannot convert `void (B::*)(int)' to `void (A::*)(int)' in initialization
------klap-------------------
Can someone explain why this is not working? Is there any workaround ?



LinkBack URL
About LinkBacks



