cs375 p. 306
Contents
Page-10
Prev
Next
Page+10
Index
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.
If an object contains a lot of data, the overhead of the extra
information is modest. However, for simple data such as Integer,
the overhead is significant.
Allocation of space in an object and access to instance variables are the
same as for records.