2013年12月8日星期日

protected modifier Why not modified top class understanding , help heroes

Top class can not use private and protected modification, because neither top- class interior in any class , there is no sub-class of its outer class , so private and protected access control character does not make sense for top class .


Why not protected against modification of the above explanations do not understand top- class , expert guidance !
------ Solution ---------------------------------------- ----

the problem is that you are protected modified this class , since it can not be accessed outside the class , and how that inheritance ?
------ For reference only -------------------------------------- -
this should be specified syntax java bar , and some can only be used for properties, methods , and some can only be used in class.
------ For reference only -------------------------------------- -
private and protected modifiers are restricted to be invoked in the case of top- class public is also being used, in the case of private and protected can not be used on equal class white writing .
------ For reference only -------------------------------------- -
modified top class if protected , if an external class inherits the top- class than the class can access it !
------ For reference only -------------------------------------- -
this is the " rules of the game " it ! Difficult to explain why ~
------ For reference only -------------------------------- -------
access to this level , it is for the class , so naturally with private and protected inappropriate use of these two modifications of internal class or method was almost
---- - For reference only ---------------------------------------

the problem is that you are protected modified this class , since it can not be accessed outside the class , and how that inheritance ?
outside the protected class can not access it? Classes in the same package , different package or subclasses of this class can access it, you explain this
inaccurate

没有评论:

发表评论