When you looked at the decorator design pattern we saw that the decorator can be implemented as both
dynamic as well as static and it just so happens that the strategy design pattern is exactly like this.
You can have a dependency on strategy as a unique PVR that you can subsequently override with a different
implementation or you can go with a static strategy where you kind of take things as pre-defined meaning
that you don't have the ability to switch the strategy a runtime in order to do this what you do is
you have a template arguments or template type name s where LS stands for strategy and what you would
do here instead of a unique Biharis you just have an instance of strategy like so.
But apart from that it's a very similar scenario except the set output format code is now completely
impossible.
It's now impossible to do because you cannot switch from one to another.
Essentially you have a pre-defined strategy that you're already referring to.
So let's see how we can use this particular approach.
So it's very similar but you cannot switch from one to another.
So if you want to have the different outputs of the text processes you basically have to make two text
processes instead of one.
So essentially you will end up having something like the following.
So if you want to print marked down you make a text Proceso with a markdown strategy.
And if you want HMO you make a text process or with the HDMI dramedies So it is impossible to jump from
one to another but apart from that the approach is pretty much the same.
We can actually run this to see what the results are.
And as you can see we're getting exactly the same output.
So the only thing that's changed is that we added the template argument here we change the type of the
variable here to basically correspond to the template argument so it gets initialized when the text
processor is made.
And also I changed from Dasch great to then to the dots in here because we no longer have a pointer
we now have a reference so this is the only difference and this is a static approach.
What I would call a static approach to the strategy design pattern not as flexible as the dynamic one
but it's still there if you need it.