How to name this key-oriented access-protection pattern?

前端 未结 4 823
花落未央
花落未央 2020-12-03 05:21

Apparently this key-oriented access-protection pattern:

class SomeKey { 
    friend class Foo;
    SomeKey() {} 
    // possibly non-copyable too
};

class B         


        
4条回答
  •  半阙折子戏
    2020-12-03 06:05

    I like, in decreasing preference:

    • passkey friend idiom
    • passkey-door friend idiom
    • pass-door friend idiom
    • key-door friend idiom
    • partial-friend idiom
    • restricted-friend idiom

    I moved away from the key-lock/key-keyhole naming scheme to the pass naming scheme, which grew on me.

提交回复
热议问题