Skip to Content
Design Patterns in Modern C++20: Reusable Approaches for Object-Oriented Software Design
book

Design Patterns in Modern C++20: Reusable Approaches for Object-Oriented Software Design

by Dmitri Nesteruk
November 2021
Beginner to intermediate
391 pages
5h 23m
English
Apress
Content preview from Design Patterns in Modern C++20: Reusable Approaches for Object-Oriented Software Design
© Dmitri Nesteruk 2022
D. NesterukDesign Patterns in Modern C++20https://doi.org/10.1007/978-1-4842-7295-4_6

6. Adapter

Dmitri Nesteruk1  
(1)
St. Petersburg, Russia
 

I used to travel quite a lot, and a travel adapter which lets me plug a European plug into a UK or US socket1 is a very good analogy to what’s going on with the Adapter pattern: we are given an interface, but we want a different one, and building an adapter over the interface is what gets us to where we want to be.

Scenario

Here’s a trivial example: suppose you’re working with a library that’s great at drawing pixels. You, on the other hand, work with geometric objects – lines, rectangles, that sort of thing. You want to keep working with those objects but also need the rendering, so you ...

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.
Start your free trial

You might also like

Design Patterns in Modern C++: Reusable Approaches for Object-Oriented Software Design

Design Patterns in Modern C++: Reusable Approaches for Object-Oriented Software Design

Dmitri Nesteruk

Publisher Resources

ISBN: 9781484272954Purchase LinkPublisher Website