Visibility Modifiers Cheat Sheet

ModifierClass membersTop-level
Public (default)Visible everywhereVisible everywhere
PrivateVisible only in the same classVisible in the same file
ProtectedVisible only in the same class and subclassesNot allowed
InternalVisible in the same module if the class is accessibleVisible in the
same module

Leave a Reply

Your email address will not be published. Required fields are marked *