How to compare two types?

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 31 16:53:30 PDT 2014


Adam D. Ruppe:

> If you want to compare the runtime type of a class object, you 
> can do:
>
> if(typeid(obj_one) == typeid(obj_two))
>
> that should tell you if they are the same dynamic class type.

And what about:

if (is(typeof(obj_one) == typeof(obj_two)))

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list