开发者

Why there are no friend classes in C#? [duplicate]

This question already has answers here: Closed 13 years ago. 开发者_JS百科

Possible Duplicate:

Why does C# not provide the C++ style ‘friend’ keyword?

A typical example where it might be needed

I have a class with private Init() function and class factory which I would like to grant access to Init();


There are no friends in C#, it's true, but you can put these classes into same file, so they both will be able to access each other's functions. Or use "partial" classes, putting only init() function of each class into the same file where your factory resides

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜