vendredi 30 décembre 2016

How to use functions with different parameters as a function parameter

The title may be a bit confusing, so I will explain it more clearly.

I have a class like:

class foo
{
public:

   foo(%Some function% *) { %Some function pointer% = %Some function%; }

   %Some output% callFunction(%Some input%);

private:

   %Some function pointer% bar;
}

Preferably, I would like to be able to store the given function in "%Some function pointer%" to be used throughout the class, but this isn't necessary.

So my main question is: How could I create a real "callFunction" that can take in any function as an input, along with that functions parameters?

Any help is appreciated!

Aucun commentaire:

Enregistrer un commentaire