Ada '83 Rationale, Sec 7.1: Introduction (to Ch 7: Derived Types)
"Rationale for the Design of the
Ada® Programming Language"
[Ada '83 Rationale, HTML Version]
CHAPTER 7: Derived Types
The basic mechanisms for defining a new type are by enumeration and by
composition from existing ones; certain operations are automatically
introduced by such definitions, for example the basic operations that
are inherent in indexing, component selection, and the formation of
aggregates. Another way of defining a type is by means of a private
type declaration.
A third possibility is provided by the language: A type COPY is said
to derive its characteristics from those of another existing type
MODEL if it is declared as
type COPY is new MODEL;
This form of declaration is useful whenever a type is to have the same
characteristics as another type, (and possibly some additional ones).
The type MODEL is said to be the parent type, and COPY is said to be a
derived type - derived from the parent type. Although the derived type
COPY and its parent type MODEL have similar characteristics, they are
nevertheless distinct types.
The following topics are some of the major uses of derived types:
- Simple strong typing
- The explanation of numeric types
- The ability to define new types that have numeric literals
- The construction of private types
- Achieving transitivity of visibility
- Change of representation
After an informal introduction to derived types, these major uses are
discussed in what follows. It will be shown that all these uses rely
on a unique ability, namely the ability to introduce a distinct type
with similar properties.
NEXT
PREVIOUS
UP
TOC
INDEX
Address any questions or comments to
adainfo@sw-eng.falls-church.va.us.