dynamic type casting in D

dave garapata at gmail.com
Sun May 30 11:46:39 PDT 2010


Hi,

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++?

ex:

interface A {...}
class B {...}
class C : B {...}
class D : B, A {...}

function(B something) {
    A a = dynamic_cast<A>(something);
}

I can't seem to find a way to check if a variable has a particular class or
interface it inherits, would be nice.


More information about the Digitalmars-d-learn mailing list