///////////////////////////////////////////////////////////////////////// // facade.cpp - implements interface methods // // // // Demonstrates use of a facade class that implements an interface's // // methods, using services of several product classes. // // // // Jim Fawcett, CSE687 - Object Oriented Design, Spring 2001 // ///////////////////////////////////////////////////////////////////////// #include #include "facade.h" using namespace std; //----< void constructor >----------------------------------------------- facade::facade() : _request(), _reply() { cout << "\n constructing facade"; // tell request how to communicate with reply _request.Register(&_reply); } //----< destructor >----------------------------------------------------- facade::~facade() { cout << "\n destroying facade"; } //----< a method solely implemented by facade >-------------------------- void facade::hello() { cout << "\n Hello. This is the facade class."; } //----< reply method delegates its action to replyProduct >-------------- std::string facade::reply() { return _reply.reply(); } //----< request method delegates its action to requestProduct >---------- void facade::request(const std::string &req) { _request.request(req); }