What is Object-Oriented Programming

By | February 24, 2024

OOPs stands for Object Oriented Programming. OOP is a programming style with Classes, Objects, Inheritance, Polymorphism, Encapsulation, Abstraction. Before OOP, Procedural Programming like C was used, based on functions. C++ introduced OOP with Objects and Classes for data and functions.  OOP provides a structured, reusable, and developer-friendly approach. It treats everything as objects, like Smalltalk, the first OOP language.

  1. Object:
    Objects are runtime entities representing real-world and user-defined data. These are instances of classes and can be physical and logical entities.
  2. Class:
    Classes are blueprint for creating objects, a user-defined data type. These are collection of objects and a basic block for OOP implementation.

OOPS Concepts

Four pillars of OOPs:

  1. Encapsulation: Wrapping data and functions in a class for restricted access.
  2. Abstraction: Representing essential features without background details.
  3. Inheritance: Objects acquire properties of other class objects, reducing redundancy.
  4. Polymorphism: Functions work in multiple forms based on input.

Features of OOPs:

  1. Message Passing: Objects communicate by sending and receiving information.
  2. Access Modifiers: Define how class members can be accessed.
  3. Abstract Class: Contains at least one pure virtual function without a definition.
  4. Exception Handling: Mechanism to handle program exceptions with try, throw, and catch.

Advantages of OOPs:

  • Scalability
  • Programmer-friendly, increased productivity
  • Data security through data hiding, encapsulation, and abstraction
  • Inheritance reduces redundant code, enhances readability, and reusability
  • Polymorphism provides program flexibility
  • Easy debugging

Disadvantages of OOPs:

  • Not universally applicable
  • Requires careful system structuring due to everything behaving like an object
  • Tricky concept, needs thoughtful implementation
  • May increase program length, leading to slower execution compared to others.

You can watch this good video about this topic –

Author: Mithlesh Upadhyay

I hold an M.Tech degree in Artificial Intelligence (2023) from Delhi Technological University (DTU) and possess over 4 years of experience. I worked at GeeksforGeeks, leading teams and managing content, including GATE CS, Test Series, Placements, C, and C++. I've also contributed technical content to companies like MarsDev, Tutorialspoint, StudyTonight, TutorialCup, and Guru99. My skill set includes coding, Data Structures and Algorithms (DSA), and Object-Oriented Programming (OOPs). I'm proficient in C++, Python, JavaScript, HTML, CSS, Bootstrap, React.js, Node.js, MongoDB, Django, and Data Science.