5. Object-Oriented Programming
Overview
By the end of this chapter, you will be able to declare classes with constants, attributes, and methods; instantiate a class; work with constructors and destructors; implement class inheritance, access modifiers, static fields, and methods; use class type hinting as dependency injection; use attribute and method overriding; apply attribute and method overloading via magic methods; use final classes and methods; autoload classes; and use traits and apply namespacing.
To summarize, we will have a look at Object-Oriented Programming (OOP) concepts that can be leveraged to write modular code.