Is it possible to make a 开发者_StackOverflownamespace friend of a class, say I have a unit test namespace with many classes and I wanted the test namespace to be friend to a class so that it has access to private implementation details.
No, this is not possible in C++. Frankly, it smacks of poor design.
If you are using .NET, you may want to take a look at the InternalsVisibleTo attribute. Anyway note that this works for whole assemblies, not for single namespaces.
精彩评论