//////////////////////////////////////////////////////////////// //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 class-function class ClassFunc { public: virtual double operator()(double x)=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){} inline double operator()(double x){ return f(x);} }; } #endif