The variant records we studied in
Chapter
12 provide much expressive power to create complex types with several
different parts. However, they have an important limitation: A variant record
must be fully defined and compiled, and CASE
statements are used
to control processing its various parts.
In this chapter we look at tagged types, a generalization of variant records that allows new variants to be added without recompiling the packages in which the original variants are declared. Tagged types implement type extension, a kind of inheritance. Inheritance is an important concept used in many object-oriented programs.
We also discuss general access types, a generalization of the access types in Chapter 14. General access types allow the programmer to create a pointer to a statically declared variable, not just a dynamically allocated block. The combination of general access types and tagged types gives a very interesting and powerful style of object-oriented programming.
Copyright © 1996 by Addison-Wesley Publishing Company, Inc.