Strategy Pattern and Delegation
Explore how delegation in C++ helps reduce tight coupling between classes by transferring operations from one object to another. Understand how delegation differs from inheritance and its role in implementing the strategy pattern to promote flexible and maintainable software design.
We'll cover the following...
We'll cover the following...
Before moving on to discuss delegation, let’s understand the motivation behind it. Generally, after learning about inheritance, programmers make the mistake of using it very frequently.
Although inheritance is a very powerful concept, it increases the coupling between the base class and the derived class. For example, ...