Re: [ROOT] New new

From: Valeriy Onuchin (onuchin@sirius.ihep.su)
Date: Fri Oct 27 2000 - 14:23:44 MEST


Thomas Bretz wrote:

>
> Hello Rooters,
>
> is there a way to create an object with something like
> TXYZ *obj = gXXX->New("TXYZ");
>
> Thanks,
> Thomas.

Hi Thomas,
check how it is done in ROOT I/O , e.g
http://root.cern.ch/root/htmldoc/src/TKey.cxx.html#TKey:ReadObj
or
http://root.cern.ch/root/htmldoc/src/TMapFile.cxx.html#TMapFile:Get

To make story short try:

TClass* cl = gROOT->GetClass(class_name);
 (TObject*)cl->New();

HTH.     Regards.    Valeriy



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET