Modules



next up previous contents index
Next: Parametric Polymorphism Up: Overview of the Previous: Classes and Inheritance

Modules

Classes and routine implementations are placed inside modules (10.1). Each module (10) implements one or more specifications. For example, a typical module contains a class implementing a type plus implementations of routines that create objects of the type.

A module encapsulates the contained code; details of any classes it contains are visible only to other code in the module. However, these details are fully exposed to code within a module. Thus, routine implementations in a module have full access to internal details of classes within the module. Similarly, classes within the same module can take advantage of implementation-specific details of one another.



theta-questions@lcs.mit.edu