Type casting

There are two forms of type casting$:$ upcasting and downcasting. Upcasting involves casting from a derived, or subclass, to a more general base class. As a result, it is safely handled with simple assignment. Downcasting works in the other direction; that is, it involves casting an instance of a base class to a more specific subclass. It should be done with sidl::babel_cast<>(). Downcasts are successful if the resulting pointer is non-NULL. This can be checked by a call using either _is_nil() -- for determining cast failure -- or _not_nil() -- for success.

NOTE$:$ Never use dynamic_cast<>() on a SIDL object since Babel's runtime system needs to be involved in verifying the legality of the downcast.





babel-1.4.0
users_guide Last Modified 2008-10-16

http://www.llnl.gov/CASC/components
components@llnl.gov