An alternative to inheritance is composition. It is quite common in programming and often gives you a better payoff. This chapter shows you a useful case study on this topic using some wrappers.
The first question that may come into your mind is: what is a wrapper? A wrapper is like a topping that surrounds an object. In programming, you often use a wrapper to add some functionalities dynamically. This is a powerful technique because you can add or discard a wrapper as per your needs, ...