13: Working With Modules and Class Interfaces
- The module's function
- A module groups class definitions together, typically
those that are functionally related-creating an application of
some kind, for example.
- Some classes in a module depend on classes in other modules
for their definition
- Class interfaces allow cross-module class definitions
- Class Interfaces
- Syntax (same as class definition, but uses "interface"
instead of class)
- What it means to define features within an interface
definition
- Feature interfaces only, no methods or properties
- Class interfaces are typically generated by the
compiler.
- Declaring a module
- Syntax is the same as presented in the last chapter
- Module items can be class declarations and class interfaces
intermixed
- Class IDs within a module must be different unless two class
definitions define the same class
- If you use the same ID for two class definitions,
the second class definition must be backward compatible-that
is, it must expand on the features of the first definition. It
can't remove or change the interface of any existing features.
- The second of two class definitions with the same ID prevails
when the classes are defined.
- Order of class definitions within a module isn't
important; a class can be defined using a class that aren't defined
until later in the module
- Use class interfaces to use classes from other
modules
- Class interfaces may be used within the module
to type-spec classes stored in another module.
- Built-in classes need not have interfaces within the module.
- Class interfaces from a module are typically created with the
compiler and stored in .i files.
- .i files are typically included in a module using the preprocessor
"#include" directive
- Sample Code
TS Ref - 26 JUN 1996
Generated by the sweat of Mike Boom's brow.