B
BlueTrin
Hello I was adapting a C version of SolvOpt in C++ to use it within a
virtual class.
However I am stuck with the overriding of evaluation and gradiant
functions.
cStepCurveEvaluator.cpp
cStepCurveEvaluator.cpp(14) : error C2296: '.*' : illegal, left operand
has type 'cStepCurveEvaluator *const '
cStepCurveEvaluator.cpp(15) : error C2296: '.*' : illegal, left operand
has type 'cStepCurveEvaluator *const '
cStepCurveEvaluator.cpp(16) : error C2296: '.*' : illegal, left operand
has type 'cStepCurveEvaluator *const '
The Class I defined is:
class cSolvOpt
{
private:
virtual double fun(double x[]) = 0;
virtual double func(double x[]) = 0;
virtual double grad(double x[],double g[]) = 0;
virtual double gradc(double x[],double g[]) = 0;
public:
cSolvOpt(void);
~cSolvOpt(void);
double cSolvOpt::solvopt(unsigned short n,
double x[],
double options[]
);
void cSolvOpt::apprgrdn ( unsigned short n,
double g[],
double x[],
double f,
double (cSolvOpt::*fun)(double*),
double deltax[],
unsigned short obj);
};
And I would like to override only fun as func, grad and gradc are not
used. The class cSolvOpt is checking if func grad and gradc a function
pointers equal to NULL.
Is there any way to NOT override these members or to initialize them to
NULL ?
Cheers
Anthony
virtual class.
However I am stuck with the overriding of evaluation and gradiant
functions.
cStepCurveEvaluator.cpp
cStepCurveEvaluator.cpp(14) : error C2296: '.*' : illegal, left operand
has type 'cStepCurveEvaluator *const '
cStepCurveEvaluator.cpp(15) : error C2296: '.*' : illegal, left operand
has type 'cStepCurveEvaluator *const '
cStepCurveEvaluator.cpp(16) : error C2296: '.*' : illegal, left operand
has type 'cStepCurveEvaluator *const '
The Class I defined is:
class cSolvOpt
{
private:
virtual double fun(double x[]) = 0;
virtual double func(double x[]) = 0;
virtual double grad(double x[],double g[]) = 0;
virtual double gradc(double x[],double g[]) = 0;
public:
cSolvOpt(void);
~cSolvOpt(void);
double cSolvOpt::solvopt(unsigned short n,
double x[],
double options[]
);
void cSolvOpt::apprgrdn ( unsigned short n,
double g[],
double x[],
double f,
double (cSolvOpt::*fun)(double*),
double deltax[],
unsigned short obj);
};
And I would like to override only fun as func, grad and gradc are not
used. The class cSolvOpt is checking if func grad and gradc a function
pointers equal to NULL.
Is there any way to NOT override these members or to initialize them to
NULL ?
Cheers
Anthony