[ODE] Moving ode test program into a class
Pete Graves
pete_graves at hotmail.com
Sun Feb 16 11:38:01 2003
I'm quite new to C++ (but some with C & Java experience), and trying to
experiment with ODE.
I've tried moving some functions [eg void start()] into a new class called
Simulation to use as part of another program. There is a few lines that
stores pointers to some of the functions, and passes them to another
function within the physics library.
// setup pointers to drawstuff callback functions
dsFunctions fn;
fn.start = &start;
fn.step = &simLoop;
fn.command = &command;
...
// run simulation
dsSimulationLoop (argc,argv,352,288,&fn);
So in the class version I have tried to write:
fn.start = &Simulation::start;
fn.step = &Simulation::simLoop;
fn.command = &Simulation::command;
But I get the error "cannot convert `void (Simulation::*)()' to `void (*)()'
in assignment"
I also tried:
fn.start = &(Simulation::start);
fn.step = &(Simulation::simLoop);
fn.command = &(Simulation::command);
But this said: "taking address of bound pointer-to-member expression".
Could someone explain what I am doing wrong?
Thanks,
Pete.
_________________________________________________________________
Surf together with new Shared Browsing
http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059