Home »

Explain the visibility of the property or method.

Question ListCategory: PHPExplain the visibility of the property or method.
alisataylore190 author asked 8 years ago
1 Answers
jully882 author answered 8 years ago

The visibility of a property or method must be defined by prefixing the declaration with the keywords public, protected or private.
Class members declared public can be accessed everywhere.

Members declared protected can be accessed only within the class itself and by inherited and parent classes.

Members declared as private may only be accessed by the class that defines the member.

Please login or Register to Submit Answer