访问控制作用

进来学习 《Think in Java》很多Java的思想观点,深入了不少~对Access Control 的一点理解记录如下:

 

   Access control puts boundaries within a data type for two important reasons.The first is to establish what the client programmers can and can't use.You can build your internal mechanisms into the structure without worrying that interface that they should be using.
   This feeds directly into the second reason,which is to separate the interface from the implementation.If the structure is used in a set of programs,but client programmers can't do anything but send messages to the public interface,then you are free to change anything that's not public(e.g.,package access,protected,or private)without breaking client code.
   
   一开始读到,Access control 即为 implementation hidding 是不是很理解,看到这里时,忽然明白了~。implementation-实现,就是类编辑者要实现功能部分,而接口(这里的含义不是和普通类class 含义相当的那个接口)就是提供给其他类调用的方法~
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值