Consider a following code:
struct X {
void MethodX() {
...
}
};
struct Y {
void MethodY() {
...
}
};
void test () {
X x;
Y y;
Dispatcher d;
d.Register("x", x, &X::MethodX);
d.Register("y", y, &Y::MethodY);
d.Call("x");
d.Call("y");
}
The question is how to implement Dispatcher. I don't mind X and Y may inheriting from something, but Dispatcher should allow further clients (not only X and Y). And I would like to avoid void* pointers if possible :)