Wouter Hulsbergen wrote: > > Dear Root, > I would like to create a member object TF1, in order to plot a member > functions, like in > > class A > { > public: > A() ; > Double_t fSquare(Double_t*, Double_t*) ; > private > Double_t a; > TF1 gSquare ; > }; > Double_t A::fSquare(Double_t* x, Double_t* par) { return a * *x * *x ; } > A::A() : gSquare("gSquare",fSquare) {} ; > > However, I get the compiler error > Error 541: "nogeentest.C", line 12 # Nonstatic member function "double > A::fSquare(double *,double *)" is used incorrectly (must be either > called > or used to form a pointer to member). > A::A() : gSquare("gSquare",fSquare) {} ; > ^^^^^^^ > I tried a lot of other things, but didn't find anything that works. Can > anybody tell me whether it is possible at all to create a TF1 from a > member function, and if, how, and if not, why ? > > Regards, > Wouter One of the TF1 constructors expect a pointer to a normal static function of type Double_t func(Double_t *x, Double_t *par) There is no constructor accepting a pointer to a class member function. You should implement a static function as quoted above and inside this function call your class member function. Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:31 MET