Specifying the visibility scope


show more Specifying the visibility scope provides you with in-depth training on Developer. Taught by Jon Peck as part of the Object-Oriented Programming with PHP show less
please wait ...

Specifying the visibility scope

As previously mentioned, visibility of a property or a method is defined using a scope keyword: public, protected, or private. If a method or property is defined as public, it means that it can be both accessed, and properties can be changed by anything that can refer to the object. Sometimes that's a good thing. You may have no need to restrict access to a property or method. For example, public methods can be exposed as part of an application programming interface or API. As an abstract example, think of public like a picnic that everybody is welcome to join.

If defined as protected, members can only be accessed within the class itself, and by inherited and inheriting classes. Inheritance will be covered in a later video, but in short, a class can have all the properties and methods of another class. The end result is a superset of all the methods and properties of both classes. The class that is inheriting the methods and properties is referred to as the child, and the class from whi...

Specifying the visibility scope
Video duration: 4m 7s 1h 57m Intermediate Updated Apr 10, 2013

Viewers:

Specifying the visibility scope provides you with in-depth training on Developer. Taught by Jon Peck as part of the Object-Oriented Programming with PHP

Subject:
Developer
Software:
PHP
Author:
please wait ...