Member function varible callable...

Hello List, I know this is probably a stupid question... I have 2 functions like: struct obj { void foo() { }; void bar() { }; } How would I store this in a variable ... so that I can call the function via the variable later... Thank you, Etienne

I have 2 functions like:
struct obj {
void foo() { };
void bar() { };
}
How would I store this in a variable ... so that I can call the function via the variable later...
using boost::function;
using boost::bind;
obj o;
// NOTE that "o" will be copied
function

On 11/05/2010 17:08, Igor R wrote:
I have 2 functions like:
struct obj {
void foo() { };
void bar() { };
}
How would I store this in a variable ... so that I can call the function via the variable later...
using boost::function; using boost::bind; obj o; // NOTE that "o" will be copied function
callFoo = bind(&obj::foo, o), callBar = bind(&obj::bar, o); callFoo(); callBar();
Thank you, Igor.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Etienne Philip Pretorius
-
Igor R