What is defined as contexto
in this pattern is just a generic way of calling the class that you will use the strategy. It’s where you need a strategy and possibly the choice which one to use.
For example, if you have a class Impostos
it can be the context to use strategies according to the state where would have implementations of strategies something like ImpostoSP
, ImpostoRJ
, etc. In this class it uses an object of one of these types of strategy (possibly more than one if appropriate). These classes treat taxes in general but the detail varies in each state and it consumes this detail of strategies.
Just be careful to take bad examples and learn wrong. The example of the code seems to actually use the pattern, but maybe not in the most appropriate way, but I’m just speculating, I don’t have enough information to state.
More information on How to instantiate Strategy objects.