How do I create an array of method pointers in C++?
The problem is, although these methods have the same signature, they are in different classes. Those classes inherit from one same class.
For example:
class A : public Base {
virtual bool work();
}
class B : public Base {
virtual bool work();
}
And I need to create an array of pointers to the methods A::work and B::work, in another class.
Edit 1:
I decided to go with Useless's suggestion, option 1:
vector<Base*> units;
Base *a = new A();
Base *b = new B();
units.push_back(a);
units.push_back(b);
Thanks