码迷,mamicode.com
首页 > 其他好文 > 详细

protected

时间:2016-10-12 17:00:41      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

protected access requires a little more elaboration. 
Suppose class A declares a protected field x and is extended by a class B, which is defined in a different package (this last point is important). Class B inherits the protected field x, and its code can access that field in the current instance of B or in any other instances of B that the code can refer to. 
 
This does not mean, however, that the code of class B can start reading the protected fields of arbitrary instances of A
 
《java in a nutshell》

protected

标签:

原文地址:http://www.cnblogs.com/lnas01/p/5953154.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!