java - subclass inheritance with different packages? -
thanks great answers inheritance. 1 more quick question:
a subclass can inherit protected members of superclass. true if not in same package?
yes, can inherit protected members of superclass regardless of package in.
from jls section 6.6.2
,
a protected member or constructor of object may accessed outside package in declared code responsible implementation of object.
from java tutorial
,
the protected modifier specifies member can accessed within own package (as package-private) and, in addition, by subclass of class in package.
i think, may required solution
Comments
Post a Comment