defines a family of algorithms, encapsulates each one, and makes them interchangeable.Strategy lets the algorithm vary independently from clients that use it.
Class A{ SortInterface i; }
Interface SortInterface{ sort(); }
Class ConcreteAlgorithm1 implements SortInterface{ sort(){ ... }
}
Class ConcreteAlgorithm2 implements SortInterface{ sort(){ ... }
No comments:
Post a Comment