An Introduction to Object-Oriented Programming
By Timothy Budd
Study Guide for Chapter 15
Learning Objectives
After reading this chapter, you should be able to:
- Explain how in conventional languages strong typing prevents
the development of reusable container classes.
-
Explain how these problems can be overcome using dynamically typed
languages.
-
Understand the limitation in the use of inheritance to overcome
these problems in strongly typed languages
-
Understand the concept of a template (or generic), and how this
mechanism permits the creation of reusable containers.
Study Questions
You may wish to use the print or save as command
on your web browser to produce a copy of this study guide.
That way you can fill in the answers to the questions as part of
your assimilating the information you learn as you read the material.
-
Explain how, in conventional programming languages, strong typing
gets in the way of developing reusable container abstractions.
-
What is the single most important feature of dynamically typed languages
that allows the creation of reusable container abstractions?
-
What is an iterator? What problem is being solved through the use of
an iterator?
-
What is the principle of substitutability?
-
When container elements are all derived from a common base class, why is
it easy to put an element into the container, but difficult to take it out?
Why must such an element know its own dynamic type?
-
How is inheritance used to hide the necessity of using casts in the containers
that are derived from a common void * container?
-
How is a template parameter like a function parameter? How is it different?
Contents copyright
Timothy Budd, 1995.