Just like objects, classes are stored in memory just as ordinary records with an extra eld: a pointer to the Virtual Method Table (VMT). This eld is stored rst, and all elds in the class are stored in the order they are declared.
Contrary to objects, all data elds of a class are always stored in heap memory.
The memory allocated looks as in table (8.6).
|
The Virtual Method Table (VMT) of each class consists of several elds, which are used for runtime type information. The VMT layout is illustrated in table (8.7). The VMT is constructed by the compiler.
|