Skip to content

Glossary: Software Design Patterns in C++

Strategy

Also written: strategy pattern

One interchangeable way of doing a job, where all versions share a shape so the code using one doesn't care which it gets. In C++ it is usually a function or lambda, such as the discount functions chosen by `discount_for`.

Where the book teaches it

Related terms

std::functioncomparatorOpen/closed principle