import std.stdio;

@safe:

extern(D) {
abstract class DA {
char foo();
}
class DB : DA {
override char foo() { return 'B'; }
}
class DC : DA {
override char foo() { return 'C'; }
}
}

extern(C++) {
abstract class CA {
char foo();
}
class CB : CA {
override char foo() { return 'b'; }
}
class CC : CA {
override char foo() { return 'c'; }
}
}

void main() {
DB db = new DB;
DA da = db;
DC dc = cast(DC) da;
writeln((dc is null)? "D cast was dynamic." : "D cast was static.");

CB cb = new CB;
CA ca = cb;
CC cc = cast(CC) ca;
writeln((cc is null)? "C++ cast was dynamic." : "C++ cast was static.");

return;
}