Say I have class A with function foo(int i) and class B with function bar(int i), as well as objectA (of class A) and objectB (of class B). I can call the functions like so
objectA.foo(10);
objectB.bar(20);
What I would like to do is have them both as function pointers in an array arr and calling them like so
arr[0](10);
arr[1](20);
Is there a way of doing this in C++? If so, how efficient is it?