I have the below class that yields this error for the lines I commented. The error I get is
ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say â&FD_Euro_Put::fâ
The signature for Forward Euler is:
Eigen::MatrixXd B::Forward_Euler(double (*f)(double), double (*gleft)(double), double (*gright)(double))
And my class is:
class C
{
protected:
A x;
B y;
double a;
double b;
Eigen::MatrixXd u;
public:
double f(tau)
{
return tau*a*x.x1;
}
double gleft(double tau)
{
return tau*b*x.x2
}
double gright(double tau)
{
return tau*a*b;
}
C(): x(), y(), a(0), b(0){}
C(char y1, double y2, double y3, double y4, double x2,
double x3, double x4, double x5, double x6, double x7):
x(x1, x2, x3, x4, x5, x6, x7)
{
double Xleft = x1*x2;
double Xright = x1*x3;
double Tauf = x1*x1;
double NN = floor((x1/x2);
a = x1*x2 - 0.5;
b = x1*x2 + 0.5;
b = C(y1, NN, Xleft, Xright, Tauf, Alpha);
u.resize(pde.N+1, pde.M+1);
if(fdtype == 'f')
u = b.Forward_Euler(&f, &gleft, &gright); //error
else if(fdtype == 'b')
u = b.Backward_Euler(&f, &gleft, &gright); //error
else if(fdtype == 'c')
u = b.Crank_Nicolson(&f, &gleft, &gright); //end problem area
else
cout << "Incorrect choice for finite difference type!" << endl;
}