学习日记

正在关注 Linux 、开源的个人博客。

首页 | 留言本 | 标签云 | 网站地图 | 美味书签 | Learning Diary | 登录 |

java中的protected提供package访问权限

2006年02月25日 下午 4:45 | 作者:littlebat

  也就是,从它们的私有性来说,依次是:private,package,protected(也提供给包以外的继承类访问),public

  摘自:Thinking in Java, 3rd ed. Revision 4.0 6: Reusing Classes protected

 It says “This is private as far as the class user is concerned, but available to anyone who inherits from this class or anyone else in the same package.” (In Java, protected also provides package access.)

  另外,因为abstract方法必须被它的继承类实现才有意义,所以它至少要提供package访问,按道理来说,应该提供protected访问,因为这样可以供在包外的继承者来实现它。

版权所有。转载时必须以链接形式注明作者和原始出处及本声明。

相关日记

随机日记

添加到网摘

[del.icio.us]  [新浪 VIVI]  [365key]  [YouNote]  [博采中心]  [Poco]  [SOHU狐摘]  [天极网摘]  [和讯网摘] 

发表评论

*必填

*必填 (不会被公开)


Copyright © 2004-2008 www.learndiary.com(学习日记)
Powered by WordPress with theme by UCDCHINA for Blogool come from JunChen Wu, nowa
联系版主:mdx-xx at tom dot com。2004.7.25