Choosing the right visibility for methods and properties - public, private or protected

choosing the right visibility

Use this decision-making process chart to choose the correct visibility for your methods (functions) and properties (variables). Use the following access modifiers:

  1. public - default behavior when it is not specified
  2. private - visible inside original class
  3. protected - same as private, but it can also be accessed by children


Visit sunny St. George, Utah, USA

Get In Touch

We would love to hear from you.

Please enter your email address.
Please enter a valid email address.
Please enter a message.
Please check your message for any errors.
Your message has been sent successfully.
Sorry, an error occured sending your message.
* required