Re: [ROOT] behaviour of DynamicCast

From: Thomas Bretz (tbretz@uni-sw.gwdg.de)
Date: Mon Dec 17 2001 - 17:35:45 MET


Hi Rene,

> Could you send me a working example? I do not see a problem.
> How did you create a TGPicture (by derivation?). The constructor is protected.

Try:
TGPicture *pic=gClient->GetPicture("AnyPictureYouWant");
cout << pic->IsA()->DynamicCast(TGWidget::Class(), pic) << endl;
results in:
Warning in <TClass::TClass>: no dictionary for class TRefCnt is
available
0x876f67c

BTW: This illustrates both problems I have:
 - the warning
 - the result isn't NULL

Best regards,
Thomas.

> > 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.



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