为什么C#不支持“朋友”关系? [英] why C# doesn't support "friend" relationship?

查看:74
本文介绍了为什么C#不支持“朋友”关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



对于朋友而言,它太乱了。关系。有没有人知道为什么它在C#中不支持
。它几乎与它不支持在C ++中支持的



继承层次结构和方法引用(调用树)浏览一样糟糕。我不知道有些人可以编写一个大规模的b / b
面向对象的应用程序。如果您已经克服了C#中的这些

限制,请分享您的想法和想法。谢谢!



It''s so messy w/o the "friend" relationship. Does anyone know why it was
not supported in C#. It''s almost about as bad as it doesn''t support the
inheritance hierarchy and method reference (calling tree) browsing that is
supported in C++. I don''t know how some could write a large scale
object-oriented application w/o those. If you have overcome these
limitations in C#, please share your thoughts and ideas. Thanks!


推荐答案



1)朋友本身并不是很好,但除此之外

你有内部和受保护的内部......


2)从主菜单查看/班级查看,您可以浏览

您的心灵内容...

1) Friend is not so great in and of itself, but that aside
you have "internal" and "protected internal"...

2) View/Class View from main menu and you can browse to
your hearts content...
-----原始消息-----

对于朋友而言,它太乱了。关系。有没有人
知道为什么C#不支持它。它差不多就像
不支持在C ++中支持的继承层次结构和方法引用(调用树)
浏览一样。我不知道有些人可以编写一个
大型面向对象的应用程序。如果您有
克服C#中的这些限制,请分享您的想法和想法。
谢谢!

-----Original Message-----

It''s so messy w/o the "friend" relationship. Does anyone know why it wasnot supported in C#. It''s almost about as bad as it doesn''t support theinheritance hierarchy and method reference (calling tree) browsing that issupported in C++. I don''t know how some could write a large scaleobject-oriented application w/o those. If you have overcome theselimitations in C#, please share your thoughts and ideas. Thanks!

.



Zeng< zz *@nonospam.com>写道:
Zeng <zz*@nonospam.com> wrote:
这对于朋友来说太乱了。关系。有谁知道它为什么在C#中不受支持。它几乎与它不支持C ++支持的
继承层次结构和方法引用(调用树)浏览一样糟糕。


挂起 - 浏览听起来它与IDE有关,而不是语言本身的
。或者我误解了?

我不知道有些人可以编写一个大型的面向对象的应用程序而不是那些。如果您已经克服了C#中的这些限制,请分享您的想法和想法。谢谢!
It''s so messy w/o the "friend" relationship. Does anyone know why it was
not supported in C#. It''s almost about as bad as it doesn''t support the
inheritance hierarchy and method reference (calling tree) browsing that is
supported in C++.
Hang on - "browsing" sounds like it''s something to do with the IDE, not
with the language itself. Or have I misunderstood?
I don''t know how some could write a large scale
object-oriented application w/o those. If you have overcome these
limitations in C#, please share your thoughts and ideas. Thanks!




由于没有做太多的C ++,我不能说已经多次出现过

我想过, 啊,我真正需要的是朋友访问。内部

通常很好 - 特别是如果你不介意为你的应用程序中的每个子系统单独设置

程序集。偶尔我觉得它有一个名称空间访问级别,比如
Java中的包访问(尽管可能没有隐式的受保护访问权限),但是 b很好这是非常罕见的



我不能说它真的是编写C#的障碍。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复该群组,请不要给我发邮件



Having not done much C++, I can''t say there have been many times where
I''ve thought, "Ah, what I really need here is friend access." Internal
is usually fine - especially if you don''t mind having a separate
assembly for each subsystem in your app. Occasionally I''ve felt it
would be nice to have a namespace access level, like package access in
Java (although possibly without its implicit protected access), but
that''s been pretty rare.

I can''t say it''s really been a barrier to writing C#.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


"一般来说,朋友的功能在C ++中是不受欢迎的,因为它打破了

自然封装。作为一般规则,你应该选择

护理你的朋友,因为你不想让任何人修补你的私人部分。

http://www.juicystudio.com/tutorial/cpp/friend.asp


" Zeng" < zz*@nonospam.com>在消息中写道

news:%2 **************** @ tk2msftngp13.phx.gbl ...
"In general, friend functions are frowned upon in C++ because it breaks the
natural encapsulation. As a general rule, you should pick your friends with
care, as you don''t want just anyone tinkering with your private parts."

http://www.juicystudio.com/tutorial/cpp/friend.asp

"Zeng" <zz*@nonospam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
继承层次结构和方法引用(调用树)浏览一样糟糕。我不知道有些人可以用这些来编写大规模的面向对象的应用程序。如果您已经克服了C#中的这些限制,请分享您的想法和想法。谢谢!

It''s so messy w/o the "friend" relationship. Does anyone know why it was
not supported in C#. It''s almost about as bad as it doesn''t support the
inheritance hierarchy and method reference (calling tree) browsing that is
supported in C++. I don''t know how some could write a large scale
object-oriented application w/o those. If you have overcome these
limitations in C#, please share your thoughts and ideas. Thanks!



这篇关于为什么C#不支持“朋友”关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆