class A { this() { } }
class B : A { this() { } }
auto b = new B()
if(b.IsCastableTo(A)) {
//...
}
How would I check if b can be casted to type A?
According to the D manual you would do:
if (cast(A) b) {
// b is an instance of A
} else {
// b is not an instance of A
}
References: