Re: [ROOT] static member function in the interpreter

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Aug 19 2002 - 18:22:09 MEST


Hi Thomas,

We have reported many times to this list that class member functions
cannot be called (static or not) because of C++ strong typing.
You must define a conventional C style function calling your class
function as you indicate.

Rene Brun

On Mon, 19 Aug 2002, Thomas Bretz wrote:

> Hi,
> 
> I have a class definition like:
> class Phys
> {
> static Double_t MyFunc(Double_t *x, Double_t *k);
> ClassDef(Phys, 1);
> };
> This is precompiled into a shared object which is loaded in rootlogon.C
> 
> In the interpreter I try to define something like:
> TF1 func("name", Phys::MyFunc, 0, 1, 0);
> 
> But I get: Symbol Phys::MyFunc is not defined.
> 
> Doing it like:
> 
> Double_t Map(Double_t *x, Double_t *k) { return Phys::MyFunc(x, k); }
> {
>    TF1 func("name", Map, 0, 1, 0);
> }
> 
> works... Is this intended? Or a feature?
> 
> Thomas.
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:05 MET