Originally posted by Scott Ambler:
...
where firstPart and secondPart are extracted from the original code.
In the child class you override it to read:
originalMethod() {
firstPart();
middlePart();
secondPart();
}
where middlepart implements that new functionality.
A second approach would be to implement originalMethod() as shown for the child class and simply stub out middlePart() in the superclass and have the child class override that.
- Scott
I like the original idea. I like the 2nd idea here much better if indeed firstpart and secondpart are the same for all implementations.