Access Modifiers

Access modifiers are used to change the visibility and access privileges for a member.

  • private

    The private keyword modifies access. The private access level is the least permissive. If a member is declared private, it can only be accessed from within the class (including inner/nested classes) or module it was declared.

  • protected

    The protected keyword modifies access. If a member is declared protected, it can be accessed from within the class/module it was declared and from any subclasses or submodules.

  • public

    The public keyword modifies access. The public access level is the most permissive. If a member is declared public, it has no restrictions on access.

Share

HTML | BBCode | Direct Link