16

Adapters and Decorators

This chapter takes on two classic patterns in object-oriented programming (OOP) - the Adapter pattern and the decorator pattern. These patterns are just two of the original twenty-three design patterns that were introduced in the Design Patterns – Elements of Reusable Object-Oriented Software book by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. As an object-oriented language, C++ can take advantage of these patterns as well as any other language. But, as is often the case, generic programming brings some advantages, variations, and, with it, new challenges to the classic patterns.

The following topics are covered in this chapter:

  • What are the adapter and decorator patterns?
  • What is the difference ...

Get Hands-On Design Patterns with C++ - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.