Just like objects, classes are stored in memory just as ordinary records with an extra field: a pointer to the Virtual Method Table (VMT). This field is stored first, and all fields in the class are stored in the order they are declared.
Contrary to objects, all data fields 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 fields, which are used for runtime type information. The VMT layout is illustrated in table (8.7). The VMT is constructed by the compiler.
|