Object Oriented Programming and Elements

What is OOPs

OOPs :- Object Oriented Programming 

This is a programming paradigm which wraps around object. In OO programming computer programs are made of objects that interact with one another.

Elements of OOPs

There are 6 elements of OOPs.
  1. Object
  2. Class
  3. Abstraction
  4. Polymorphism
  5. Inheritance
  6. Encapsulation
These elements should be present in an OOP based language. Readers, lets focus on each of these


Any real world physical or non physical entity which has attribute, behaviour and identity is object.
For example :-
Your laptop is an object. It has color (red, black, silver..) as attribute. It has on and off as behaviour and it has a identity which makes your laptop unique.
To be more clear on this state thing, lets say you and your friend have identical laptops.  If your laptop os shutdown that does not mean that your friend's laptop is also shut down. So there is third type of thing called identity which makes your object(laptop) unique.


A class is blueprint of an object which can produce instances of its own type.
For example :-
When a builder is going to start a project, he/she has a blueprint of the building that shows all the parts of single floor. So this is same as your class.
Later in this project builder uses this blueprint to build all the other floors which are same as making same type of objects out of blueprint. So in this example builder's blueprint is analogy of a class.

I have written individual posts on other elements of OOPs.