Introduction to Object Oriented Programming in PHP

OOPs stands for Object Oriented Programming which is all about creating class and objects. Class serves as a template and multiple objects can be created using the class.

Oops concept reduces code repetition. Classes are templates for creating objects.

For an example, if we see a game take it as a Racing game where we will be having multiple cars which will be running there. So in this case either we have to write codes for each car individually or else we can create a class for car and then we can use it multiple times for the other class with that class name.

A class is a self-contained, independent collection of variables and functions which work together to perform one or more specific tasks, while objects are individual instances of a class.

We can see an example given below:

References:

Joydeep M
Latest posts by Joydeep M (see all)
Tagged : / / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x