POV-Ray : Newsgroups : povray.programming : POV-Ray 3.5 for AmigaOS : Re: Bah. Server Time
3 Jul 2024 05:34:28 EDT (-0400)
  Re: Bah.  
From: Thorsten Froehlich
Date: 11 Jul 2004 16:56:06
Message: <40f1a966@news.povray.org>
In article <40f10727@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:

>   dynamic_cast converts between class pointers, but it checks at runtime
> that the cast is valid. If the cast is invalid, it returns a 0 pointer.
> This is usually done for downcasting a pointer and checking that it
> succeeded.
>   Usually, though, if you need to downcast, it's a sign of bad OO design.

I don't think one can generalise that using dynamic_cast suggests a bad
design somewhere.  Without dynamic_cast a less-static binding of objects
would not be possible at all.  The only real problem with dynamic_cast is
that it has a (by newbies unexpected) runtime overhead that cannot be
predicted very well...

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.