Testing derived type

Nick Sabalausky a at a.a
Sat Jul 5 14:03:33 PDT 2008


I assume there's some way to do the following (D1 and Tango) without 
converting to and comparing strings, but...how?

module modA;
class base {}
class derivedA : base {}
class derivedB : base {}
class derivedC : base {}

module modB;
base[] array;
foreach(base elem; array)
{
    if(elem.toString[locatePrior(elem.toString, '.')+1..$] != 
derivedA.stringof)
    { /* do stuff */ }
}




More information about the Digitalmars-d-learn mailing list