dynamic type casting in D
bearophile
bearophileHUGS at lycos.com
Sun May 30 12:04:00 PDT 2010
dave:
> sort of new to D programming, coming from C++. Basically the question is if
> there is some sort of a way to dynamically cast a variable in D much like you
> do in C++?
D conflated all kinds of casts into the cast() syntax. So dynamic_cast can be done with a cast().
> I can't seem to find a way to check if a variable has a particular class or
> interface it inherits, would be nice.
Cast it and if it is not null, then the dynamic cast is allowed. Or do you need some other information?
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list