go to previous page   go to home page   go to next page hear noise


An object is a section of main memory that contains both data and methods and that behaves like an individual entity.


An Object

Objects are often described as follows:

It is useful (but not quite accurate) to think of an object as a contiguous chunk of memory that contains both data and machine code, as in the picture.

Of course, general purpose memory (symbolized by the yellow bricks in the picture) can hold both data and machine code. So an object can be built out of general purpose memory.

In object oriented programming, a subroutine of an object is often called a method of the object. So an object consists of data and methods.


If a program constructed 1000 objects, would it be efficient to make 1000 copies of the machine code for each object?