Dynamic and Static Casting

d coder dlang.coder at gmail.com
Thu Feb 10 03:14:12 PST 2011


Greetings All

I have learnt that D has only one casting operator and that is 'cast'.
The same operator assumes different functionality depending on the
context in which it he being used.

Now I have a situation where I have to downcast an object and I am
sure of the objects type and thereby I am sure that the downcast would
only be successful. To make the operation faster, in C++ I could have
used static_cast operator, thus giving the RTTI a skip. Would this be
possible in D? Can I force a static_cast which downcasting?

Regards
- Cherry


More information about the Digitalmars-d-learn mailing list