Passkey Idiom

2018-06-08 ☼ codingc++

Pretty simple but an example helps:

class Foo {
    class Permission { 
        Permission()= default; 
        template<typename T> friend class Bar; 
    void kinda_private(int i, Permission) {
        // can only be called by Bar<T>s

Lets you make single methods kinda public” but can only be called by things that are friends of the Permission class.