Implementation of Objects
An object is basically just a record, with a bit of extra information:
- A tag to identify the record as an object. It may be more
efficient to tag the class, eliminating the need to tag each object;
if the language is strongly typed, runtime tags may not be needed.
- The class of the object: a pointer to the class data structure.
- The instance variables of the object.
Thus, an object requires only slightly more storage than an ordinary record.
Allocation of space in an object and access to instance variables are the
same as for records.