Strategy pattern
I have a question about Strategy pattern, I use the example(http://www.jdon.com/designpatterns/designpattern_Strategy.htm) in this website to talk about the question ;
My question is that why Strategy pattern uses the class RepTempRuleSolve (called Context in GOF), I know that RepTempRuleSolve is used by client program to decide which stratgy to use, for example:
|
the code here makes the decision to use the strategy implementation RepTempRuleTwo, but why the code does not use the stategy implementation without using RepTempRuleSolve ?
for a new client code example here:
|
In the second example, the client code uses the strategy implementation with using the RepTempRuleSolve; In both examples, the client code also needs to make the decision which strategy implementation to be used, so what's the the benefits of use the class RepTempRuleSolve ?