////////////////////////////////////////////////////////////////
//this class provides an alernative to functions which can be viewed as classes
//                          S.Plaszczynski 29/11/02
//////////////////////////////////////////////////////////////////////


#ifndef CLASSFUNC_H
#define CLASSFUNC_H

namespace SOPHYA {

//! Abstract interface definition for functions (double f(double)) viewed as classes
class ClassFunc {
public:
  virtual double operator()(double x) const =0;
};

//ClassFunc constructed from a a function:simple forward to function
class Function : public ClassFunc {
 private:
  double (*f)(double);
 public:
  Function(double (*g)(double)):f(g){}
  virtual  double operator()(double x) const { return f(x);}
};

}

#endif
