Testing derived type

Frank Benoit keinfarbton at googlemail.com
Sat Jul 5 14:37:32 PDT 2008


Koroskin Denis schrieb:

> Or use
> 
> ....
> if ( elem.classinfo !is derivedA.classinfo ) {
>     // do stuff
> }
> ....
> 
> to skip derivedA instances only (and not derivatives).

you can reuse the casted ref in the same if:

if ( auto o = cast(derivedA)elem ) {
     /* do stuff, use o */
}



More information about the Digitalmars-d-learn mailing list