Hi!

I want to do something like this:

test.cpp
----------------
class abc{
     int i;
    double a;
    public:
       double (*f)(double x);
      double func1(double x);
      double func2 (double y);
      void update(double x1);
};

void update(double x)
{
          switch(i){
             case 1:
                       f=func1;
                       break;
              case 2:
                        f=func2;
                        break;
          }
 }

---------------------------------------------
First of all, I am aware of the pointer to class member functions. But
that requires explicit knowledge of object. There we do something like
this:

int main()
{
      double x=3.0;
     double (abc::*fn)(double x);
     abc b1;
      fn=&abc::func1();
       cout<<(b1.*fn)(double x);
}

But this is not what I want to do. First of all, I am accessing one
member function by another member function where object declaration is
not required. I want to use a pointer to access the other member
functions within the class as demonstrated above. Is it possible to do
this?

Regards,
swagat

_______________________________________________
Help-gplusplus mailing list
Help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to