Wrapper Design Pattern In C++

preview_player
Показать описание
In this video we will learn about a wrapper class.
A wrapper and a proxy class are both structural design patterns, but they serve different purposes and have different characteristics:
Few Points About Wrapper Class:
* A wrapper class, as the name suggests, wraps or encapsulates another object and provides an alternative interface or behavior to it.
* The primary purpose of a wrapper class is to add functionality to an object without modifying its interface. It allows you to extend or modify the behavior of the wrapped object.
* Wrapper classes are often used for adding logging, caching, or additional functionality to existing classes.
* A wrapper class typically implements the same interface as the wrapped object, providing a transparent layer around it.
* Clients interact with the wrapper class as if it were the original object, unaware of the additional functionality provided by the wrapper.

JOIN ME

#designpattern #softwareengineer #cppprogramming
Рекомендации по теме
Комментарии
Автор

This pattern is really useful in Domain Driven Design. Thanks for the overview!

Joserbala
Автор

Thanks for the video. Is it possible to use inheritance in C++ to achieve the same goal?

siavashjafarpour
Автор

Is the wrapper design pattern the same as adapter pattern?

mehtubbhai
Автор

How about deriving wrapper vector from std::vector and override its member functions for convenience ?

matthieucharrier
Автор

Just to add - This is also known as Decorator design pattern

vvpChannel