All Courses > Up and Running > Chapters > The Concepts of Object-Oriented PHP You Need to Understand for WordPress Development

The Concepts of Object-Oriented PHP You Need to Understand for WordPress Development

Key Takeaways:

Object-oriented programming is a dominant programming paradigm that encourages programmers to think in terms of distinct classes of things. All members of a class share particular methods (functions) and properties (variables). For example, Television would be a good class, with a screen_width property and a turn_on() method.
Classes are instantiated as objects—individual elements of the class that have the class's properties and methods. In PHP, this would look like: $this_tv = new Television();. One might then access $this_tv->screen_width, or call $this_tv->turn_on().
Inheritance creates a subclass of a class. Objects of a subclass inherit all the properties of the parent class, as well as additional properties of the subclass. For example, HD_Television might extend Television and add a change_resolution() method.
Object-orientation is broadly useful in WordPress as a wa...