After walking the heap to reverse engineer the memory layout
of a class in MFC, I figured this forum might provide a better
answer. How does a C++ compiler build the memory layout of a class
and a derived class? Also, what is the difference in memory layout
of a regular C++ compiler and the memory layouts used by SOM compilers
to provide binary consistency? Thanks in advance,

Naturally, different compilers do it differently.

If I remember right, g++ places the base structure first
(using the normal C structure rules), then a virtual
function pointer if required, then any inherited classes
one after another.

Borland C places the virtual function pointer BEFORE the
first structure, at a negative offset. Inherited classes
as before.

Don't know how they handle multiple inheritance, virtual
base classes, or having the first virtual function in an
inherited class.