Re:C++ Patterns: The Badge
by gowld on Tuesday June 11, 2019 @09:34PM
(#20161023)
That doesn't solve the problem the OP solves, which is to expose a method only to a specified set of other classes.
[ Parent
| on HN ]
It solves the problem by decoupling the public interface and necessary implementation details (object size), the register/unregister functions can be moved to an internal only header file, maybe even some file scoped functions. AFAIK this is not possible with a class declaration.
I think you could also solve this specific problem with an internal header file in c++ too (by moving register/deregister to it's own class) but this solution solves other problems like binary compatibility.