Re: [ROOT] Why double cast with TDirectory::Get?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Sun Aug 04 2002 - 14:12:35 MEST


The correct comment should be to always use
   dynamic_cast<>() which will always work independent of where TObject
is in the class hierarchy. It is avialable on all supported ROOT
platforms so there are no portability issues. We'll modify the comment
accordingly.


Cheers, Fons.


On Sat, 2002-08-03 at 01:18, David Faden wrote:
> Hi,
>    Why must one first cast the result of TDirectory::Get(const char*) to 
> void* before casting to the desired type if the desired type doesn't 
> derive directly from TObject? (I'm looking at the comment for 
> http://root.cern.ch/root/html/TDirectory.html#TDirectory:Get )
>    Thank you.
> 
> David
> 
> 
> 
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



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