An Introduction to Object-Oriented Programming
By Timothy Budd
Study Guide for Chapter 9
Learning Objectives
After reading this chapter, you should be able to:
-
Contrast the is-a rule and the has-a rule.
-
Describe the mechanisms of inheritance and composition.
-
Describe some of the advantages and disadvantages of using
inheritance, and contrast these with the advantages and disadvantages
of using composition.
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 in this chapter.
-
What is the principle of substitutability?
-
What is the is-a rule of thumb? What is the has-a rule of thumb?
- Give three examples in real life of pairs of concepts which satisfy the
is-a relation, and three pairs which satisfy the has-a relation.
-
Give a short characterization of the software reuse technique known as
composition.
-
Give a short characterization of the software reuse technique known as
inheritance.
-
What is a private inheritance? How does it differ from normal (public)
inheritance?
-
What are some of the advantages of composition over inheritance?
What are some of the advantages of inheritance over composition?
-
What is the yo-yo problem?
-
What are some of the problems that prevent the widespread application
of reusable general purpose components in software construction?
Contents copyright
Timothy Budd, 1995.