ho... easy hey!
but how about the other 2 test I'd like be able to run?
bool isTypeOf(T)(TypeInfo ti) { "return T is ti" }
bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { "return ti1 is ti2" }
"Jonathan M Davis" wrote in message
news:mailman.988.1308367581.14074.digitalmars-d-le...@puremagic.com...
On 2011-06-17 19:58, Lloyd Dupont wrote:
given
----
A a = ....
class A {}
class B : A {}
----
how could I test, at runtime, if "a" is just a "A" or is a "B"?
Cast it. The result will be null if the cast fails.
if(cast(B)a)
//it's a B
else
//it's an A but not a B
- Jonathan M Davis