I have a class which should hold a pointer to methods of various classes and call them via it.
Something like here but with a small -or maybe not- difference. Those various other methods are not overloaded.
Example:
Derived1 d1;
OtherClass* handlerInst = new OtherClass();
handlerInst->Add( &d1, &(Derived1::method1) );
In Add(...)
I want to pass whatever member method of class types derived from base.
Is this possible somehow?
Edit:
The idea is that OtherClass is a thread(not standard c++ thread). Some code of other classes(Derived1, derived2...)-it is not mandatory to have a common base class- can thus must be run only after this thread has ended its run. I am hoping to see if i can add methods with whatever name. Also being a thread has nothing to do with this. It can be a simple class which when it ends its method it runs some code from other classes.