From the course: C++ Design Patterns: Structural
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Complex interface demo - C++ Tutorial
From the course: C++ Design Patterns: Structural
Complex interface demo
- [Instructor] Now, let's look at a demo project that will help us understand the need for the facade pattern. Let's say we are building a hotel reservation system. The system needs to coordinate the work of several existing components, such as a database library, a payment gateway, and a messaging service. Here's the source code of our demo project. We can see that each component or subsystem is implemented as a separate class. We have a database class to store reservations, a payment gateway to process payments, and a messaging service class to notify customers about their reservations. To keep the demo straightforward, these classes do not implement the actual functionality. Instead, they just log a message to the console. When a customer books a reservation, the system needs to store the details in the database, process their payment with the payment gateway, and notify them with the messaging service, as…