首页 > 其他 > 详细

protected

时间:2016-10-12 17:00:12      阅读:286      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!