OOP (Object Oriented Programming) Concept

OOP stands for Object oriented programming. OOP focuses on objects rather than actions and data rather than logic. Many of today's programming language is an OOP like C#, PHP, VB etc..

Class is a blueprintis an idea, is a description, is describe what something is, it's a well-defined idea.

For example if you are creating an E-commerce website, you will create a classes that represents a User, Post and a Review

All classes define two things which is Attributes and Behavior

Attributes is a characteristics, for example we will describe the Person. The Person will have an attribute of name, height, weight, gender and age.

Where's the Person Behavior is something that it can do like Walk, Run, Jump, Sleep and Work.

Think about that the Attributes is your variable that can hold your data while the Behavior is a function or methods.

In other programming language Attributes describes as Properties and Behavior describes a Methods.

Now that we have a Person Class that has a name, height, weight, gender and age. It doesn't say what the name is or what the weight is. Because the class is just a description of something. Its like, there is no point of creating a blueprint if you are not intended to create a house. So there is no point defining a Class unless if you're going to create an Object. So that's the relationship of Class and Object. Class is an idea, and the Object is the thing itself.

We create an Object based on the Class, just like building a House based on the blueprint.
We can create multiple Object based on one Class, just like we can build multiple house based on one single blueprint.

Comments