开发者

Interaction of namespace and friend in C++?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜