RE: [ROOT] problem with constructors of user defined classes

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue May 18 2004 - 20:33:06 MEST


Hi Guido,

Without more information I would say that the constructor:
   RootDBField(string name);
is not known to CINT and that the following would work
   PixLib::RootDBField rf("prova",0);

Cheers,
Philippe

PS. you did not specify the version of ROOT you are using.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Guido Gagliardi
Sent: Thursday, May 13, 2004 11:49 AM
To: roottalk@cern.ch
Subject: [ROOT] problem with constructors of user defined classes


Hi ,

i have a problem in calling from the interactive session of ROOT the 
non-default constructors of my user defined classes.
I have a class with the constructor:

RootDBField(string name);

into a namespace PixLib;

If i type in the interactive session:

PixLib::RootDBField r("test")

i get the error:

root [5] PixLib::RootDBField rf("prova")
Error: Can't call RootDBField::RootDBField("prova") in current 
scope:1le) LINE
Possible candidates are...
Error: class,struct,union or type RootDBField not defined  
FILE:(tmpfile) LINE:1
filename       line:size busy function type and name
*** Interpreter error recovered ***

however, if i get the longer way:

root [2] std::string * s = new std::string("prova")
root [3] PixLib::RootDBField* r = new PixLib::RootDBField(*s,0)

the object is correctly instantiated, and i can use it

Where is my error?
(note that also:

std::string s("prova")

do not works, and give the same kind of error "Can't call....")

Thank you
Guido



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET