Join Jon Peck for an in-depth discussion in this video Specifying the visibility scope, part of Object-Oriented Programming with PHP.
- View Offline
- Exercise Files
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 which the methods and properties are coming from is…
- Historical overview of object-oriented PHP
- Defining classes
- Creating a method/object context with $this
- Accessing classes without instantiation
- Creating a database class
- Extending and abstracting classes
- Cloning and comparing objects
- Error handling with exceptions
- Implementing design patterns, such as the factory and strategy patterns
Skill Level Intermediate
PHP with MySQL Beyond the Basicswith Kevin Skoglund10h 26m Intermediate
1. Introduction to Object-Oriented Programming
2. Creating Your First Object
3. Overloading with Magic Methods
Overloading property access6m 37s
4. Accessing Classes without Instantiation
5. Class Relationships and Interactions
6. Built-In PHP Objects
Customizing PHP exceptions4m 23s
7. Design Patterns
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.