3: Patterns
Abstract
Design patterns offer general solutions to common software design problems. This chapter provides details for various design patterns and C++ idioms that are particularly relevant to application programming interface (API) design. This includes the pimpl idiom, which provides a way to hide all internal details from your public header files. The Singleton pattern provides access to global state. Its implementation in C++ can be tricky, so singleton best practices and thread safety are covered. The Factory Method patterns make up for several limitations of C++ constructors and can be used to hide implementation details for derived classes. Various patterns for wrapping a new API on top of an incompatible or legacy interface ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access