4.1. The Concepts of Object Orientation

In contrast to procedural languages, object-oriented languages treat all pieces of data that functions are working with as objects. When using the strict object-oriented paradigm, functions are no longer called functions but are called methods. Methods can only be defined for objects. A method for computing the sum of two values that has been defined for the object called a cannot be used for computing the sum of two values belonging to the object called b. At first glance, this seems stupid because you need two methods for performing one simple calculation, but in fact it can be an advantage. All methods belonging to a certain object can be treated as one union. Every object has a predefined programming ...

Get PHP and PostgreSQL: Advanced Web Programming 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.