Re: [gtkmm] Replacing dynamic_cast<> with static_cast<> - compiler error.



On Wed, 2002-09-18 at 15:29, Paulo Pinto wrote:
> > Unfortunately you are right. Since we're dealing with pointers for the
> > polymorphism then the compiler can't know what will be passed in so a
> > static_cast cannot be used. The dynamic_cast checks at run time and will
> > throw an exception if the cast cannot be meaningfully performed.
> >
> > Nick
> 
> 
> Right. I know that it doesn't sound pretty but we could replace the
> dynamic_cast
> with a reinterpret_cast or even an old style cast (ugh did I just said
> that?).

That would compile, but would cause crashes. That's why we have
static_cast<>, dynamic_cast<> etc.

-- 
Murray Cumming
murrayc usa net
www.murrayc.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]