9#include "helpers/formatstring.h"
38 std::cout << std::endl;
39 std::cout <<
"Visitor Exercise" << std::endl;
41 std::cout <<
" Creating Village" << std::endl;
42 std::unique_ptr<Visitor_Village> village = std::make_unique<Visitor_Village>();
43 village->LoadVillage();
48 village->Name.c_str())
53 village->Accept(&visitor);
54 if (!visitor.ItemsReceived.empty())
59 visitor.ItemsReceived[0].c_str(),
60 visitor.ShopNameReceivedFrom.c_str())
65 std::cout <<
" Failed to receive a hamburger" << std::endl;
68 std::cout <<
" Done." << std::endl;
Implementation of the OrderVisitor class used in the Visitor Pattern.
A visitor used for ordering items from various shops. The user starts with an instance of this class ...
Declaration of the Visitor_Exercise() function as used in the Visitor Pattern.
Declaration of the Visitor_Village class used in the Visitor Pattern.
std::vector< std::string > StringList
Typedef for a vector of std::string.
The namespace containing all Design Pattern Examples implemented in C++.
void Visitor_Exercise()
Example of using the Visitor design pattern.
std::string formatstring(const char *fmt,...)
Use the given string and arguments to return a buffer containing the formatted string....