注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

随机过程

http://superware.blog.163.com

 
 
 

日志

 
 

C# Encapsulation  

2014-06-10 21:31:36|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

      Encapsulation is implemented by using access specifiers. An access specifier defines the scope and visibility of a class member. C# supports the following access specifiers:


1、Public

Public access specifier allows a class to expose its member variables and member functions to other functions
and objects. Any public member can be accessed from outside the class.

2、Private

Private access specifier allows a class to hide its member variables and member functions from other functions
and objects
. Only functions of the same class can access its private members. Even an instance of a class cannot
access its private members.

3、Protected

Protected access specifier allows a child class to access the member variables and member functions of its base
class
. This way it helps in implementing inheritance. We will discuss this in more details in the inheritance chapter.

4、Internal

Internal access specifier allows a class to expose its member variables and member functions to other functions
and objects in the current assembly
. In other words, any member with internal access specifier can be accessed
from any class or method defined within the application in which the member is defined.

5、Protected internal

The protected internal access specifier allows a class to hide its member variables and member functions from
other class objects and functions, except a child class within the same application
. This is also used while
implementing inheritance.


C Encapsulation - superware - 随机过程

  评论这张
 
阅读(87)| 评论(0)
推荐

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017