|
![](/i/fill.gif) |
In article <40f10727@news.povray.org> , Warp <war### [at] tag povray org> 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] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |