Object Oriented Programming (OOP) Introduction#
What Is The Object?#
- Every entity in this universe can be an
object. Anobjectcan haveattributesandbehaviors.Attributes: are properties of the object, for ex: Name, Color, Size and so on.Behaviors: actions of the object, for ex: Do, Move, Run, and so on.
- For example, we have a motorcycle object.
- So this motorcycle object can have
attributes:- Name: Honda
- Color: Black
- Made-In: Japanese
- Model: Wave
- This motorcycle object also can have
behaviors;- Run
- Stop
- Start Engine
- So this motorcycle object can have
What Is The Class?#
- In
OOP, theClassdefines the blueprint of Objects. They define the properties and behaviors of the objects. For example, Laptop is a class and your laptop is an instance of it.
What Is The OOP?#
Object-oriented programming (OOP)is a programming paradigm based on the concept of object, which can contain data and code:- Data in the form of fields (often known as attributes or properties).
- Code, in the form of procedures (often known as methods or functions).
- Another definition of
OOPis a way to build flexible and reusable code to develop more advanced modules and libraries. OOPhas 4 main concepts: