5.8 Chapter 5 Summary

[ Table of Contents ] Prev ] Chapter Overview ] [ Glossary/Index ]

As usual, we begin with some self-test questions.  (Answers are listed below in reverse order.)

Self-Test Questions
Click Q#-# to see answer

Q5-1 What is the Ada term for a hierarchy of types, where each descendant type inherits properties from its parent?
Q5-2 What are tagged types used for?
Q5-3 When reading the declaration of a tagged type operation, how can you tell whether it is a classwide operation or a dispatching operation?
Q5-4 When you program a call to a dispatching operation, what determines whether it will be dispatched statically (at compile time) or dynamically (at run time)?
Q5-5 What are the names of the three predefined procedures that can be overridden, providing extra control to the programmer creating a controlled type?
Q5-6 What are some of the advantages of using inheritance and dynamic dispatching?

Key points of this chapter

Answers to Questions

A5-6 More reuse of software modules, reduced demands for testing, and less copying and re-compiling.
A5-5 Initialize, Adjust and Finalize are the three overridable procedures used in constructing controlled types.
A5-4 If the controlling actual parameter in the client code is of a definite type, static dispatching occurs. If the controlling actual parameter in the client code is of a classwide type, dynamic dispatching occurs.
A5-3 If the formal controlling parameter is of a classwide type, the operation is a classwide operation. If the formal controlling parameter is a definite type, the operation is a dispatching operation.
A5-2 Tagged types make it possible to create a derivation class hierarchy with "type extension" and support for dynamic (run time) dispatching.
A5-1 The term "derivation class" refers to an Ada implementation of a hierarchy of  types related via inheritance.

[ Click here to return to questions ]

Wrap-up Discussion

This chapter has provided an introductory discussion of the classification style of object oriented programming, as done in Ada, along with several example programs illustrating relevant techniques. Key terms included in the Glossary/Index are:

abstract

class (Ada)

class (OOD)

classification

classwide operation

classwide type
controlled type controlling parameter derivation class
dispatching operation hierarchy inheritance
object object oriented programming tagged type
type

The next chapter provides an introductory discussion of concurrency and synchronization, as done in Ada.

[ Back to top of pagePrev ] [ To next chapter ]