Object-oriented programming is a programming paradigm that works around objects. it is a way or class of programming that uses objects and classes to create real-world applications. OOPs is not a programming language. it is a way to given shape to real-world objects in a programming language.

For example let say a car has different brands, color, functionality, and features. some functions are hidden to users like we don't know how the internal functionality of a function works and how two things are connected with each other. and same happened with object-oriented programming. OOPs, are used to bind data and functions together to make a new feature using inheritance, hiding, polymorphism, etc.

Object-oriented programming is not connected with a specific programming language. it is a feature that can be implemented by programming language or not. just like c programming is not an Object-oriented programming language, where c++ have both OOPs and procedural programming language feature. and java is a complete Object-oriented programming language.

Features of an Object-oriented programming language.

  1. Inheritance
  2. Encapsulation
  3. Abstraction
  4. Polymorphism


In Object-oriented programming Inheritance allow a class to share their features like methods, functions, and variables with another class. if the attributes and behaviors are defined in a class then we can inherit that class into another class to access these attributes and behaviors. and the class that feature is inherited is called parent class and the class that inherits the functionality of that class is called the child class.


Encapsulation means hiding some information inside an object and only exposing the necessary information to the outside world. this feature is used to hide some private data like application keys from the outside world. that help to secure the application from others.

when we declare some methods inside a class and when an object is created using the class, the data encapsulated in that object. to use this feature in OOPs we need to declare some feature private and some features in public mode.

A private method can only accessible inside the class. and a public method can access from outside the class.


In OOPs abstraction means only selecting or providing that information that needs to be accessible from the outside world to work an object. for example, in a car, only the needed parts like a brake, accelerator, steering, and gear are accessible by the user. another functionality is hidden inside the parts.


Polymorphism means sharing behaviors by objects. we can make the same object work on different functionality. in OOPs programming we can declare functions with the same name with different arguments and this feature is called method overriding. or we can declare the same function in two classes with the same name and this feature is called method overloading.

Method overriding is also called compile-time polymorphism and method overloading is also called run time polymorphism.

Benefits of using OOPs in programming.

  1. Using Object-oriented programming we can make a complex application in a simple form.
  2. We can use the code multiple times and need to declare only one time.
  3. we can easily debug our application.
  4. we can hide some internal data from the users. that make our system more secure.