What is object oriented programming
It is used for creating a object which contain both properties and methods.
Why we should learn
oops
1. Easy to understand
2. Easy to reuse the code
3. Easy to maintain
4. It will save the time
2 Main Aspects of oops
1. class -
A class is a blueprint of object.
2. object -
A object is a real world entity.
4 Pillars of Object oriented programming
– Abstraction
– Encapsulation
– Inheritance
– Polymorphism
1. Abstraction
Data abstraction is used to hide the internal details but shows essential things to user.
2. Encapsulation
Encapsulation is used to hide the data from users. - In this properties get and set method are used.
3. Polymorphism
Polymorphism is used to perform a single action in different ways.
4. Inheritance
That concept of oops where one class inherit the properties from other class.
Inheritance with examples
Example: Bus, car, bike are the child class and their parent class is vehicle. Here these classes inherit the properties from vehicle class.
Types of Inheritance
- Single Inheritance - Multiple Inheritance - Hybrid Inheritance - Hierarchical Inheritance