Namespace and friend interaction in C ++?

Is it possible to create a namespace name for a class, say I have a unit test namespace with many classes, and I wanted the test namespace to be friendly to the class so that it had access to private implementation information.

+5
source share
2 answers

No, this is not possible in C ++. Honestly, this is a bad design.

+1
source

If you are using .NET, you can take a look at the InternalsVisibleTo attribute . In any case, note that this works for entire assemblies, and not for individual namespaces.

0
source

All Articles