I have to make a library as an assignment that would implement a menu-like functionality on a linux terminal. So I have to for each submenu enable a position to be either another submenu or a call to some function.
I was wondering how to implement such a call. Since it is to be a library, it could be used to a dozen of different kinds of functions, taking different number and types of arguments.
How to implement such a method calling another functions that would not assume anything about those functions any yet could call them? Should I use templates somehow or is there another method for that; or maybe I should implement it in a whole other way?
You can use objects with virtual methods to do this. Then the application can decide, which parameters to put into the callback object.