The adapter structural pattern allows you to change the interface of an object. This lets you reuse code that would not normally fit into your design.

This is a simple pattern that mostly describes how to forward calls from a desired interface method to another method that you’re trying to adapt. You can either use inheritance or object composition to accomplish this.

Your first choice is to use inheritance. Create a class that inherits from an interface your code expects and then also inherits from the other code that you’re trying to adapt. You’ll normally inherit publicly from the interface that your code expects and privately from the class you’re adapting.

Your other choice is to use object composition where your wrapper just implements the interface your code expects and forwards any necessary calls to a member variable of the class you’re adapting. This will normally be a pointer because that gives you the power to forward calls not just to some predefined class but to any other class that inherits from the class you’re adapting.

Many times, this design pattern is called a wrapper.