Answers for "c++ callback member function"

C++
4

c++ callback member function

class Foo {
	int (*func)(int);
  
public:
  	void setCallback( int (*cFunc)(int) ) {
      func = cFunc;
    }
  
  	void set() {
    	setCallback(callback);	// Set callback function to be called later
    }
  
    void use() {
      	func(5);	// Call the previously set callback function
    }
          
  	// Note the 'static'
    static int callback(int param) {
      	return 1;
    }
};
Posted by: Guest on July-30-2020

Code answers related to "c++ callback member function"

Browse Popular Code Answers by Language