CSci 581: Obj.-Oriented Design & Programming
Spring Semester 1999
Lecture Notes


Replacement and Refinement

This Web document was based on a set of "slides" created by the instructor for use in the Fall 1997 offering of the object-oriented design and programming course. That set was, in turn, based on a set of slides created by Timothy Budd to supplement chapter 11 of his textbook An Introduction to Object-Oriented Programming, Second Edition (Addison-Wesley, 1997).


Replacement and Refinement

What happens when child classes have methods with the same names as parent?

There are two general models describing this situation:

Replacement:
"American" school of OOP -- child method replaces parent method

Refinement:
"Scandinavian" school of OOP -- behavior of parent and child classes are merged to form new behavior

If replacement used, then some mechanism usually provided for refinement

If refinement default, then replacement not possible


Preserving is-a

Replacement makes preserving principle of substitutability difficult