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
|
// Base class
class Base
{
public:
dMatrix Base::*nrfunc (double,double,double,double);
dMatrix quad3d(dMatrix (Base::*func)(double, double, double, double), double x1, double x2)
{
nrfunc=func;
return qgaus_n_log(&Base::f1,x1,x2);
}
dMatrix f1(double y)
{
return (this->*nrfunc)(ksav, zsav, y, z_v);
}
void Result()
{
quad3d(&Base::Integrand,x1,x2);
}
//set virtual - to be defined in inherited class
virtual dMatrix Integrand (double, double, double, double);
dMatrix qgaus_n_log(dMatrix (Base::*integ) (double), double a, double b)
{
//here is just summ
}
}
class Next: public Base
{
public:
dMatrix Integrand (double, double, double, double)
{
// here is definition.
}
}
// then in main(), create Next obj and call Result();
|