From the course: C++ Design Patterns: Structural

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Challenge: Implement a protective proxy

Challenge: Implement a protective proxy - C++ Tutorial

From the course: C++ Design Patterns: Structural

Challenge: Implement a protective proxy

(upbeat music) - [Instructor] In this C++ challenge your goal is to implement a protective proxy to limit access to a resource. The protective proxy acts as an intermediary between the client and the actual resource and adds access control rules to ensure that only authorized clients can access the protected resource. Here's the starting demo featuring the class we want to protect from unauthorized access. The SecureStorage class inherits from storage and initializes its string data member in the constructor. The get contents method returns this string. That's a pretty straightforward design. Your task is to implement a protective proxy that limits access to the SecureStorage class, allowing only users who know the secret code to access the protected resource. You can use a similar approach, as in the previous example. Create a proxy class that exposes the same public interface as SecureStorage, but with access control…

Contents