Your great ideas will be born here
source code edit
download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <boost/function.hpp>
#include <boost/bind.hpp>
using namespace std;
class Callback {
public :
void set_callback_function( boost:: function < void ( ) > function ) {
this- > callback_function = function;
}
void execute_callback_function( ) {
if ( ! callback_function.empty ( ) )
callback_function( ) ;
}
private :
boost:: function < void ( ) > callback_function;
} ;
class MiClase {
public :
void funcion( ) {
cout << "¡iujú! ¡Si se llamó!" << endl;
}
} ;
int main( ) {
Callback callback;
MiClase miclase;
callback.set_callback_function ( boost:: bind ( & MiClase:: funcion , & miclase ) ) ;
callback.execute_callback_function ( ) ;
return EXIT_SUCCESS ;
}
input / output show all
hide all
upload with new input
result:
Success
time: 0s
memory: 2684 kB
returned value: 0
 
Would you like to manage your submissions? Sign up now and enjoy the full functionality of Ideone.
input: no
output:
¡iujú! ¡Si se llamó!
result:
Success
time: 0s
memory: 0 kB
returned value: 0
 
Would you like to manage your submissions? Sign up now and enjoy the full functionality of Ideone.
input: no
output:
¡iujú! ¡Si se llamó!