什么是访问说明符的保护,内部在C#中保护之间的区别 [英] What is the difference between access specifier protected and internal protected in C#

查看:168
本文介绍了什么是访问说明符的保护,内部在C#中保护之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是访问说明符保护内部保护在C#?

What is the difference between access specifier protected and internal protected in C# ?

推荐答案

内部可以在组件中可见一斑。

Internal can be seen within the assembly.

保护可通过类从它定义的类继承中可以看出。

Protected can be seen by classes inheriting from the class where it is defined.

受保护的内部可在大会或类型从它的定义(包括其他组件类型)派生的类中可见一斑。

Protected internal can be seen within the assembly OR types derived from the class where it is defined (including types from other assemblies).

参见: http://msdn.microsoft.com/en-us/library/ ba0a1yw2.aspx

从页面复制:

public              Access is not restricted.
protected           Access is limited to the containing class or types derived from the containing class.
internal            Access is limited to the current assembly.
protected internal  Access is limited to the current assembly or types derived from the containing class.
private             Access is limited to the containing type.

这篇关于什么是访问说明符的保护,内部在C#中保护之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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