How do you check if object o has base type B?
Rikki Cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Feb 3 21:54:49 PST 2016
T[] list;
foreach(v; list) {
if (SpecialT v2 = cast(SpecialT)v) {
writeln(v2);
} else {
writeln("err");
}
}
That should work.
More information about the Digitalmars-d-learn
mailing list