3 lines
884 B
Markdown
3 lines
884 B
Markdown
Паттерн "Стратегия" определяет семейство алгоритмов, инкапсулирует каждый из них и обеспечивает их взаимозаменяемость. Он позволяет модифицировать алгоритмы независимо от их использования на стороне клиента.
|
||
|
||
Каждая утка СОДЕРЖИТ экземпляры FlyBehavior и Quack Behavior, которым делегируются выполнение соответствующих операций. Подобные связи между двумя классами означают, что используется механизм композиции. Поведение не наследуется, а предоставляется правильно выбранным объектом. |