Object Oriented PHP

The Major difference between PHP 4 and PHP 5 is, PHP 4 is not object oriented but PHP 5 is full object model.

Some Features of Object Oriented Language:-

Class: is a collection of member variables and functions.

Object: is a instance of the class. We can define a class once and then make many objects that represent to it.

Variables: defines inside a class, holds different types of values like numbers, strings, etc.

Function: defined inside a class and are used to access object data.

Inheritance: When a class is defined by inheriting existing function of a parent class then it is called inheritance.

Polymorphism: When same function is used for different purposes, by passing different types, numbers or change orders of arguments then it called Polymorphism.

Data Abstraction: Representation of data in which the implementation details are hidden called Data Abstraction.

Encapsulation: Encapsulation is a method through which we kept all the data and member functions together to form an object.

Leave a Reply