dummy question : runtime type testing...

Lloyd Dupont ld-REMOVE at galador.net
Fri Jun 17 19:58:49 PDT 2011


given
----
A a = ....
class A {}
class B : A {}
----
how could I test, at runtime, if "a" is just a "A" or is a "B"?


also, give a type T and a TypeInfo variable, how can I know if a variable of 
type T is attributable to a variable of type described by TypeInfo?
i.e. how could I implement the method below?
bool isTypeOf(T)(TypeInfo ti) {  /* how to check and return whether T is a 
ti or a subclass */ } 



More information about the Digitalmars-d-learn mailing list