Like getClass()
torhu
no at spam.invalid
Sat Sep 27 10:50:18 PDT 2008
bearophile wrote:
> Sergey Gromov:
>> typeof() gives a static type of an object. But I was sure that
>> thing.classinfo.name should have referred to the dynamic type name.
>> Apparently it's not the case, it prints the same test.FooBar as in your
>> test.
>
> Thank you for your answer.
> So the question here is: is the information I need present at runtime somewhere?
> If the answer is true, then the problem is how to get it.
obj.classinfo doesn't work the way you'd expect with an interface, but
it works when you've got an object:
writefln((cast(Object)thing).classinfo.name);
This does look ugly, though.
More information about the Digitalmars-d-learn
mailing list