[ROOT] C++ Question

From: Olivier Meplan (meplan@isn.in2p3.fr)
Date: Thu Mar 15 2001 - 10:17:06 MET


Hi Rooters!
I have a C++ question....It is related to pointer to functions of a
class. I want define in a base class a method (name RK in the example)
which used pointer to methods of a derived class...and I don't now how
to do. Here is what I do (and which of course don't work):

the base class A:

class A {
   void (*Fct)(double t,double *X,double *dX);
   void RK(...);
};
 RK methods use the pointer Fct.

then a class B:

class B : public A {
    ...
   void EDP1(double t,double *X,double *dX);
   void EDP2(double t,double *X,double *dX);
   void Evol(...);
};

Now in the method Evol(...) I want to use A::RK(...) with either EDP1 or
EDP2 for the pointer Fct (e.g. Fct=EDP1) but the cast don't work.

Is there any way to do what I want?
Thanks a lot
Olivier Meplan



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:39 MET