Tuesday 30 April 2013

Access Specifiers and Visibility of data member

VisibilityPublicProtectedDefaultPrivate
Within the Same ClassYesYesYesYes
From a class within the same packageYesYesYesNo
From a subclass within the same packageYesYesYesNo
From a subclass outside the packageYesYes, through InheritanceNoNo
From a non-subclass outside the packageYesNoNoNo

No comments:

Post a Comment