C++: How do I pass a function(without knowing its parameters) to another function?

Posted by Ninja on Stack Overflow See other posts from Stack Overflow or by Ninja
Published on 2011-01-29T15:14:36Z Indexed on 2011/01/29 15:25 UTC
Read the original article Hit count: 187

Hi all. I'm trying to create a function that will store and repeat another function given as a parameter for a specific amount of time or repeats given. But when you want to pass a function as a parameter you have to know all of its parameters before hand. How would I do if I wanted to pass the function as one parameter, and the parameters as another?

void AddTimer(float time, int repeats, void (*func), params); // I know params has no type and that (*func) is missing parameters but it is just to show you what I mean

Thanks in advance

© Stack Overflow or respective owner

Related posts about c++

Related posts about pointers