Thanks to your other question it looks like this pattern is now known as the “passkey” pattern.
In C++11, it gets even cleaner, because instead of calling
b.protectedMethod(SomeKey());
you can just call:
b.protectedMethod({});
More Related Contents:
- Can we increase the re-usability of this key-oriented access-protection pattern?
- clean C++ granular friend equivalent? (Answer: Attorney-Client Idiom)
- How to name this key-oriented access-protection pattern?
- C++ Singleton design pattern
- Is Meyers’ implementation of the Singleton pattern thread safe?
- Singleton: How should it be used
- What’s the scope of inline friend functions?
- Why does C# not provide the C++ style ‘friend’ keyword? [closed]
- How to declare a templated struct/class as a friend?
- Can any one provide me a sample of Singleton in c++?
- What is Proxy Class in C++
- Singleton instance declared as static variable of GetInstance method, is it thread-safe? [duplicate]
- Are inner classes in C++ automatically friends?
- declare template friend function of template class
- ampersand (&) at the end of variable etc
- Friend scope in C++
- Generating an interface without virtual functions?
- boost::asio and Active Object
- friend class with limited access
- ‘friend’ functions and
- friend AND inline method, what’s the point ?
- Is it bad practice to allocate memory in a DLL and give a pointer to it to a client app?
- Why does a C++ friend class need a forward declaration only in other namespaces?
- Memory management patterns in C++
- a class-key must be declared when declaring a friend
- How does the friend keyword (Class/Function) break encapsulation in C++?
- Decorator pattern in C++
- Double dispatch/multimethods in C++
- Specify a class member function as a friend of another class?
- friend declaration declares a non-template function [duplicate]