Very complex constructor


I need to define a constructor that also constructs an object that has a function as parameter.

This would be something like

myClass::myClass(): myClass2(myFunction(myParam))

myClass2.function1(); ...

I saw this code example but I really would need explanations.

Thanks, I am going to decipher it.

Try making it a little less abstract. Having a function pointer as a class member is not hard (even though function pointer syntax is sinfully hideous), and certainly doesn't come close to "very complex".

What kind of class are you intending to make? Do you need to store the function and parameter itself, or just the result of the function call?