I am trying to pass the void function to another void function, unsuccessfully so far. So I created this function inside an ExitButton class like this. ExitButton.h:
class ExitButton{
void setup(void (*_setup));
};
Then I include this class in another class like this. ofApp.h:
include "ExitButton.h"
class ofApp : public ofBaseApp{
void update();
void setup();
StartButton *startButton;
}
So, in myApp.cpp, I want to call the update function as follows:
void ofApp::update(){
exitButton->setup(setup());
}
So, I assume that I can only pass the void function, which is a pointer? Is it possible to pass the void function as a parameter to another function?
source
share