Works on GCC.
#include <cstdio>
int main() {
class A{ virtual void x(){} };
class B{ virtual void x(){} };
#define X(a,b,c) class a: public b,c {};
X(C, A, B); X(D, A, B);
X(E, C, D); X(F, C, D);
X(G, E, F); X(H, E, F);
X(I, G, H); X(J, G, H);
X(K, I, J); X(L, I, J);
X(M, K, L); X(N, K, L);
X(O, M, N);
O c;
printf("%c", (char)((long*)(A*)(C*)(E*)(H*)(I*)(K*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(B*)(C*)(F*)(G*)(I*)(L*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(A*)(C*)(F*)(H*)(I*)(L*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(A*)(C*)(F*)(H*)(I*)(L*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(B*)(D*)(F*)(H*)(I*)(L*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(A*)(C*)(E*)(G*)(I*)(L*)(M*)&c - (long*)&c));
printf("%c", (char)((long*)(B*)(D*)(F*)(G*)(J*)(K*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(B*)(D*)(F*)(H*)(I*)(L*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(A*)(D*)(E*)(G*)(J*)(L*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(A*)(C*)(F*)(H*)(I*)(L*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(A*)(C*)(F*)(G*)(I*)(L*)(N*)&c - (long*)&c));
printf("%c", (char)((long*)(B*)(C*)(E*)(G*)(I*)(L*)(M*)&c - (long*)&c));
printf("%c", (char)((long*)(A*)(D*)(E*)(H*)(I*)(K*)(M*)&c - (long*)&c));
}
I guess it works.
gynvael:haven> g++ hello.cc && ./a.out
Hello World!