Reflection: Get all inherited classes of a base class

nrgyzer nrgyzer at unknownMailAddress.com
Sat Dec 22 14:14:28 PST 2012


Hi everyone,

is it possible to get a list of all inherited classes from a base 
class like this:

class A {
    ...
}
class B : A {
    ...
}
class C : A {
    ...
}
class D : B {
    ...
}

auto myClasses = __traits(allInheritedClasses, A); // I'm looking 
for something like this.
assert(myClasses, [B.classinfo, C.classinfo, D.classinfo]);

All I found wasn't exactly what I need, hence I hope there is any 
chance to do something like that or is there currently no chance?

Thanks for any advice!


More information about the Digitalmars-d-learn mailing list