Revising object-oriented programming

Object-oriented programming is more than just classes and objects; it's a whole programming paradigm based around objects (data structures) that contain data fields and methods. It is essential to understand this; using classes to organize a bunch of unrelated methods together is not object orientation.

Assuming you're aware of classes (and how to instantiate them), allow me to remind you of a few different bits and pieces.

Polymorphism

Polymorphism is a fairly long word for a fairly simple concept. Essentially, polymorphism means the same interface is used with a different underlying code. So multiple classes could have a draw function, each accepting the same arguments, but at an underlying level, the code is ...

Get Mastering PHP Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.