【转载】#303 - Accessibility of Class Members

类成员的访问权限
本文介绍了类成员的不同访问级别,包括public、private、protected、internal和protected internal等,并解释了这些关键字如何应用于字段、属性、方法等不同类型的类成员。

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:

  • public - All code can access the member
  • private - Only other code in the class can access the member
  • protected - Code in this class or any class that inherits from this class can access
  • internal - Code in files in the same assembly (.dll or .exe) can access
  • protected internal - Code 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.

原文地址:#303 - Accessibility of Class Members

转载于:https://www.cnblogs.com/yuthreestone/p/3593226.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值