Re: [ROOT] behaviour of DynamicCast

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Dec 18 2001 - 09:51:43 MET


Hi Thomas,

I have fixed this problem with TClass::DynamicCast in the CVS source.

A NULL pointer will be returned in your example and no warnings about TRefCnt
reported.

Rene Brun

Thomas Bretz wrote:
> 
> Dear rooters,
> 
> I have some problem. I'm doing a
> obj->IsA()->DynamicCast(TGWidget::class(), obj)
> If this object is a TGPicture I get a result instead of NULL.
> In my opinion doing a dynamic cast from TGPicture to TGWidget should
> result in NULL rather than an object, because it isn't derived from
> TGWidget, which can easily be tested by a
> obj->IsA()->InheritsFrom(TGWidget::class())
> Is this behaviour intended? If so, why?
> 
> This happens with root 3.02/06 and can easily be reproduced in the
> interpreter.
> 
> Best regards,
> Thomas.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:12 MET