X
xuatla
Hi,
I have a problem about using a class member function as a parameter in
another function.
What I tried to implement is something like described below:
class A
{
public:
double evaluate( double (*func)(double), double x )
{ return func(x); } ;
...
} ;
class B
{
private:
double func1( double a )
{ return 1.0; } ;
double func2( double a )
{ ... } ;
public:
int compute(double a)
{
evaluate( func1, a ); // (***)
...
}
} ;
I have problem for the above (***) part.
I also tried
evaluate( B::func1, a );
evaluate( (*this)::func1, a );
evaluate( this::func1, a );
but none of them works.
I know that I need to read some comprehensive materials about this part.
But can I get some help from you guys here first? I will also be very
appreciated if you point out some reference to me.
Thank you.
-xuatla
I have a problem about using a class member function as a parameter in
another function.
What I tried to implement is something like described below:
class A
{
public:
double evaluate( double (*func)(double), double x )
{ return func(x); } ;
...
} ;
class B
{
private:
double func1( double a )
{ return 1.0; } ;
double func2( double a )
{ ... } ;
public:
int compute(double a)
{
evaluate( func1, a ); // (***)
...
}
} ;
I have problem for the above (***) part.
I also tried
evaluate( B::func1, a );
evaluate( (*this)::func1, a );
evaluate( this::func1, a );
but none of them works.
I know that I need to read some comprehensive materials about this part.
But can I get some help from you guys here first? I will also be very
appreciated if you point out some reference to me.
Thank you.
-xuatla