Access Specifiers

Public

  • Any program/ function outside the class can access.
  • Generally given to methods

Protected

  • Visible within class and its subclasses

Private

  • Only methods inside class can access.
  • Generally given to attributes

Backlinks