11#include "helpers/formatstring.h"
41 std::string
DoWork(std::string someArgument)
71 std::cout <<
" --> Creating instance of real class..." << std::endl;
95 std::string
DoWork(std::string someArgument)
97 std::cout <<
" --> proxy class DoWork() in" << std::endl;
99 std::cout <<
" --> Forwarding DoWork() call to real class..." << std::endl;
100 return realClass->
DoWork(someArgument);
115 std::cout <<
" --> Creating instance of proxy class..." << std::endl;
116 return std::make_unique<Proxy_Class_Private::Proxy_Class>();
Declaration of the IWorkByProxy interface and the Proxy_Classes_Container class used in the Proxy Pat...
static std::unique_ptr< IWorkByProxy > CreateProxy()
Retrieve a new instance of the proxy class.
The proxy class that implements the IWorkByProxy.
std::string DoWork(std::string someArgument)
Do some work on a std::string.
std::unique_ptr< DesignPatternExamples_cpp::IWorkByProxy > _realClassInstance
The one and only instance of the real class associated with this proxy class instance.
DesignPatternExamples_cpp::IWorkByProxy * _GetRealClass()
Helper method to retrieve the one and only instance of the real class. This hides the details of inst...
The real class object that does all the work.
std::string DoWork(std::string someArgument)
Does some work on the given argument and returns a new std::string.
The namespace containing all Design Pattern Examples implemented in C++.
std::string formatstring(const char *fmt,...)
Use the given string and arguments to return a buffer containing the formatted string....
Hides the details of the proxy and real class in C++. Used by the Proxy pattern example.
Represents what can be done on the proxy object. This same interface is implemented on the real objec...
virtual std::string DoWork(std::string someArgument)=0
Does some work on the given argument and returns a new std::string.