strategy_pattern

In this example I´m going to explane the strategy pattern. With this example you can do a calculation with two numbers (-/+) and expand the number of operators (/, *, etc.). First create a interface which defines the interface of the operator classes. For this example an operator can only calculate two values. //The interface for the strategies public interface ICalculateInterface { //define method int Calculate(int value1, int value2); } Next create the operators (strategies) Minus (which subtract value 2 from value More Info »