Accessibility of Class Members

Members of a class can have different kinds of accessibility. An accessibility keyword indicates what source code can access the member.  The different types of accessibility are:

  • publicAll code can access the member
  • privateOnly other code in the class can access the member
  • protectedCode in this class or any class that inherits from this class can access
  • internalCode in files in the same assembly (.dll or .exe) can access
  • protected internalCode in the same assembly or in classes that inherit from this class can access

Accessibility keywords can apply to the following kinds of members of a class: fields, properties, methods, constants, indexers, events, constructors and nested types.  They can apply to both instance and static members.

【转载】Accessibility of Class Members,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。