An Introduction to Object-Oriented Programming
By Timothy Budd
Study Guide for Chapter 11
Learning Objectives
After reading this chapter, you should be able to:
-
Explain the difference between refinement semantics
and replacement semantics for inheritance,
and the advantages and disadvantages of each.
-
Explain how refinement semantics can be simulate with replacement semantics.
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.
-
What is the difference between a subclass adding a method and a subclass
overriding a method?
-
What is the difference between replacement and refinement semantics?
Why is the first often called American semantics, and the second
Scandinavian semantics?
-
What are some of the advantages of replacement semantics?
What are some disadvantages?
-
Why does replacement semantics conflict with the principle of substitutability?
-
What are some of the ways that can be used to ensure that when a subclass
replaces a method with another, the second performs in a similar fashion
to the first?
-
What are some of the advantages of refinement semantics?
What are some disadvantages?
-
How can refinement be simulated in a language that uses replacement semantics?
Contents copyright
Timothy Budd, 1995.