I have a function under Base class and at the definition tine of this base class function I need to call another function which is define under the Derived class. how to do this??
My class declaration is below
Code:
class Base{
   
  public:
   
  void showdata(double);
   
  };
   
  class Derived : public Base{
   
  public:
                  inline double F(double x)
  {
                  return exp(-x) + x*x;
  }
Define the function below :

Code:
void Base::showdata(double a)
  {
                  std::cout<<"The value of the Function : " << F(a);
  }
and the main function :
Code:
int main()
  {
  //Base obj;
  Derived obj;
  obj.F(1.0);
  return 0;
  }
I'm getting an error :
Quote:
error C3861: 'F': identifier not found
I know this is a correct error but I need to call a derived class function into the base class function.Is it possible any how?? or I have to go different way like template etc
So how to solve this problem.
With Warm Regards
sdmahapatra

Last edited by sdmahapatra; 20Jul2009 at 16:11..