Design patterns implementation examples

Proxy

Definition:

Replaces original object implementation with another in order to protect orginal object or to perform some optimization


Example:

A real-life example is an extension lead. Let's say we have a device that we want to plug in but power point is too far so we use extension lead (proxy) which does not change interface, but just passes it on.


C++ code:

/src/proxy.cpp
Download source code

Proxy UML class diagram:
Proxy UML class diagram

Proxy UML sequence diagram:
Proxy UML sequence diagram