So what is an object? In Computer Science, object can be a variable, data structure, function or a method that has some value and is referenced by an identifier. In class-based OOP, objects are instances of classes. Here’s an example class in PHP code:
There are object properties and object methods. In previous examples, “quantity” and “price” are properties while “getFullPrice” is a method that returns the product of quantity and price. This is how an Object is instantiated in PHP:
A class can have a constructor. A constructor, also called “ctor”, is a special procedure called to create an object. It can accept arguments and put the values inside the object properties.
Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Data encapsulation led to the important OOP concept of data hiding. Properties can be
In OOP, Polymorphism is the object’s ability to appear in many different forms depending on their data type or class. It is the ability to redefine methods for derived classes.
For more information about Object-oriented programming, I suggest starting with this Wikipedia article.