哥们 为了回答你这个问题,我去查了下oracle官网
http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html
其他的都不懂,不过官网有这么一句话:A subclass does not inherit the private members of its parent class. However, if the superclass has public or protected methods for accessing its private fields, these can also be used by the subclass.
我英语不太好,不能准确的翻译,大概意思是:一个子类不继承父类的私有成员,然而,如果父类有提供公共的,或者受保护的方法,那么子类可以利用这些方法访问私有属性了!
|