Possible to get Class of Interface at runtime

Josh Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 22 15:38:58 PST 2016


If I have:

interface A {}
class B : A {}

void printClass(A obj){
     // Code here
}

Is there any way that I can find out what class obj is inside of 
printClass? I know I can cast and check if(cast(B)obj) but I want 
to just be able to do something along the lines of obj.class. I 
can think of other solutions but just wondering if something like 
this was possible.



More information about the Digitalmars-d-learn mailing list