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

Mithlesh Upadhyay is a Computer Science and AI expert from Madhya Pradesh with strong academic background (BE in CSE and M.Tech in AI) and over six years of experience in technical content development. He has contributed tech articles, led teams, and worked in Full Stack Development and Data Science. He founded the w3colleges.org portal for learning resources.