It is natural to think of objects as containing other objects. A television set contains a tuner and video display. A computer contains video cards, keyboards, and floppy drives. The computer can be considered an object unto itself, and the floppy drive is also considered a valid object. You could open up the computer and remove the floppy drive and hold it in your hand. In fact, you could take the floppy drive to another computer and install it; because it works in multiple computers, the fact that it is a standalone object is reinforced.

The classic example of object composition is the automobile. Many books, training classes, and articles seem to use the automobile as the essence of object composition. Besides the original interchangeable ...

Get Object-Oriented Thought Process, The, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.