rtti cast

terranium spam at here.lot
Thu May 8 07:58:24 PDT 2008


Janice Caron Wrote:

>
> (1) traditional cast is not a typecheck, it's a type conversion
> (2) dynamic cast is a a runtime type check
> 
Typecheck just determines whether an object can be cast to the target type, so this is boolean function similar to Java's instanceof and C#'s is. dynamic cast does a type conversion and applies a typecheck during the conversion and the result depends on whether the typecheck succeeded. It was noted that for failed typecheck for pointer type null is returned and for failed typecheck for reference type bad_cast is thrown. And D reference types are very similar to those of C++ (at least in syntax :) ) except that C++ reference can't be changed after initialization.



More information about the Digitalmars-d mailing list