Object Oriented Programming (OOP Concept)
WHY WE STUDY OOP?
OOP is basically a concept of Object & Class.
Object Oriented Programming has several advantages:-
1. OOP is faster and easier to execute.
2. OOP provides a clear structure for the programs.
3. OOP helps to keep the code easier to maintain, modify and debug.
4. OOP makes it possible to create full reusable applications with less code and shorter development time.
CLASS
A class describes the contents of the objects that belong to it.
OBJECT
An object is an element of a class; objects have the behaviours of their class.
PILLERS
There are 4 main pillars of OOP (Object Oriented Programming).1. INHERITENCE
2. POLYMORPHISM
3. ABSTRACTION
4. ENCAPSULATION
INHERITENCE
In Inheritance, there is a Parent Class in which we use its properties and methods to its Child Class.
POLYMORPHISM
Poly = multiple & morph = change
In Polymorphism, an object can be changed from one form to another.
A real-life example of polymorphism is a person who at the same time can have different characteristics. A man at the same time is a father, a husband, and an employee.
ABSTRACTION
In Abstraction, a programmer hides an object's implementation details and only showing the user the relevant data and the information that is absolutely necessary. to reduce complexity and increase efficiency.
ENCAPSULATION
Encapsulation is the process of bundling the data and methods into one unit.