1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Class Integration{
public:
double* variableinclass1;
double* variableinclass2;
typedef void (Integration::*funcPtr_func)(double,double*,double*,double*);
functionToIntegrate1(double,double*,double*,double*){d=variableinclass1};
functionToIntegrate2(double,double*,double*,double*){d=variableinclass2};
double integrate(funcPtr_fun,double a,double*b,double*c,double*d,double*result){
this->(*funcPtr_fun)(a,b,c,d);
result=d;
};
void run(double,double*,double*,double*){
double result [2];
integrate(&functionToIntegrate1,a,b,c,d,result);
printf("Function1 integrated=(%f,%f)",result[0],result[1]);
integrate(&functionToIntegrate2,a,b,c,d,result);
printf("Function2 integrated=(%f,%f)",result[0],result[1]);
};
}
|