9#include "helpers/formatstring.h"
32 std::cout << std::endl;
33 std::cout <<
"Decorator Exercise" << std::endl;
36 baseElement = std::make_shared<TextElement>(
"This is raw text");
40 std::make_shared<WhiteBackgroundDecorator>(
41 std::make_shared<UnderlineDecorator>(
42 std::make_shared<RedForegroundDecorator>(baseElement)));
52 std::cout <<
" Done." << std::endl;
Implementation of the IRenderElement interface, Decorator base class, TextElement class,...
Declaration of the Decorator_Exercise() function as used in the Decorator Pattern.
The namespace containing all Design Pattern Examples implemented in C++.
void Decorator_Exercise()
Example of using the Decorator design pattern.
std::string formatstring(const char *fmt,...)
Use the given string and arguments to return a buffer containing the formatted string....
std::shared_ptr< IRenderElement > shared_ptr_t
An alias to simplify syntax for this shared pointer.