This chapter will show you two important techniques. First, you’ll learn to use a template method. Why is this important? Template methods are one of the fundamental techniques for code reuse. Suppose you follow a multi-step algorithm to achieve a task. Using a template method, you can redefine some of these steps (but not all them) without altering their calling sequence.
This chapter starts with a demonstration that uses a template method. Later, you’ll use a hook method in addition ...