What is Object-Oriented Programming

Last Updated :

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 –

Comment
Next Article
Mithlesh Upadhyay Published 02 Aug, 2023 · 2 min read

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.

Article Tags :

Similar Reads

  • Four Pillars of Object-Oriented Programming (OOPS)

    Get an overview of four pillars of object-oriented programming (OOP) and see their suitable real life examples. What is OOP? Picture a cluttered garage🛠️. Tools are scattered everywhere,…

    4 min read
  • Default Parameters in Python Functions

    A default parameter is a value provided in function declaration that is automatically assigned by the compiler if caller of the function doesn’t provide a value for the…

    1 min read
  • Python Program to Swap String Case Without Using swapcase()

    Generally, we use swapcase() to swap strings in Python. What if we are asked to do swapping without using the method. In this article, I will be sharing…

    1 min read
  • What is Overriding in C++

    Write a program in C++ to depict the concept of overriding or Dynamic polymorphism. Overriding is a type of polymorphism. Polymorphism in OOP languages means to take more…

    2 min read
  • What should we use void main() or int main() ?

    There is question that what should we use void main() or int main() ? void main() { /* ... */ } Or, int main() { /* ... */…

    2 min read
  • C Comments

    Prerequisite – C Language Introduction C comments explain code and improve readability. These do not affect program execution. You can use comments in C to clarify code and describe…

    1 min read