"swagat" <[EMAIL PROTECTED]> writes: > I want to do something like this:
Your question isn't very clear. Perhaps you shoul read this: www.catb.org/~esr/faqs/smart-questions.html > class abc{ ... > }; > > void update(double x) void abc::update(double x) > { > switch(i){ > case 1: That shouldn't compile: > f=func1; // error: cannot convert `double (abc::*)(double)' to `double (*)(double)' in assignment ... > break; > } presumably here you want to call the function through the pointer just assigned, and don't know how to do so? > } > > I want to use a pointer to access the other member > functions within the class as demonstrated above. Is it possible to do > this? I think, you want this: class abc { int i; double a; public: double func1(double x); double func2(double x); void update(double x); }; void abc::update(double x) { double (abc::*f)(double); switch (i) { case 1: f = &abc::func1; break; case 2: f = &abc::func2; break; } (this->*f)(x); } If that's *not* what you want, try to ask your question in a clearer way. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. _______________________________________________ Help-gplusplus mailing list Help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus