diff --git a/language/oop5/visibility.xml b/language/oop5/visibility.xml index b03d50486c..1d5930d043 100644 --- a/language/oop5/visibility.xml +++ b/language/oop5/visibility.xml @@ -4,17 +4,21 @@ Visibility The visibility of a property or method can 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. + 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. Property Visibility - Class properties must be defined with public, private, or protected. + Class properties must be defined as public, private, or + protected. If declared using var without an + explicit visibility keyword, the property will be defined as + public. @@ -85,8 +89,9 @@ $obj2->printHello(); // Shows Public, Protected2, Undefined Method Visibility - Class methods must be defined with public, private, or protected. Methods - without any declaration are defined as public. + Class methods may be defined as public, private, or + protected. Methods declared without any explicit visibility + keyword are defined as public.