Object Oriented Programming Concept

Anjali GuptaAnjali Gupta
4 min read

Table of contents:

  1. Oops, a concept in c++?

  2. Why do we need OOPs?

  3. Advantages of OOPs?

  4. Conclusion

    Oops concept in c++?

    Object-oriented programming is a popular programming style that gained popularity through its incorporation of object-oriented concepts into the C programming language. Object-oriented programming allows developers to group related pieces of code into classes, which can then be used to create objects. These objects represent aspects of real-world entities and can be manipulated using specific methods and properties. Aspects of the program that relate to these objects are then encapsulated, or shielded from other parts of the program. This helps to keep the code more organized and reusable, which is why it is often used in large software projects.

    A general example of oops in our life:

The human body is composed of many different parts which are common to both men and women. These parts include two legs, two arms, a head, eyes, a nose, a mouth, ears, and a heart. Except for some differences between male and female anatomy, everyone walks, eats, and sees in the same way. Men and women also have conversations and hear sounds in the same way. Differences only occur about certain tasks that one sex can perform better than the other. For example, while females are capable of giving birth, males cannot.

Class

Classes are a blueprint for a functional entity, like Human Beings. They have specific body parts and abilities, just as individuals do.

Objects

My name is Anjali, and I am an instance or object of the class female. When we say Human beings, Male or Female, we just mean an instance of this kind. We have a physical existence while a class is just a definition that can be applied to any instance of that class. We are the objects.

Abstraction

Abstraction is the act of highlighting only the pertinent aspects while concealing other underlying details. Continuing our previous example, Human Beings are capable of speaking, walking, hearing, and eating; but the specifics of these activities are hidden from view. For us, this could be represented by our skin, which obscures the inside workings of our body.

Encapsulation

Encapsulation is a concept that can be difficult to explain with our example. Our legs are bound together so we can walk. Our hands are also bound together, so we can hold things. This binding of the properties to functions is called Encapsulation.

Polymorphism

Polymorphism is a concept that allows us to redefine the way something works by either changing how it is done or changing the parts using it. Both ways have different terms for them.

If we walk using our hands, and not legs, here we will change the parts used to perform something. Hence this is called Overloading.

And if there is a defined way of walking, I wish to walk differently, but using my legs, like everyone else. Then I can walk as I want, this will be called Overriding.

Inheritance

Considering human beings as a class, which has properties like hands, legs, eyes, etc, and functions like walking, talking, eating, seeing, etc. Males and Females are also classes, but most of the properties and functions are included in human beings, hence they can inherit everything from class human beings using the concept of Inheritance.

Why do we need OOPs?

Object-Oriented Programming has the following reasons to use

  1. OOP provides a clear modular structure for programs

  2. OOP makes it easy to maintain and modify existing code

  3. OOP provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer.

  4. Code Reusability

  5. It is suitable for real-world problems and real-world works

Advantages of OOPs?

There are miscellaneous benefits of oops we have to just focus on learning. It is a vast concept by which we can make good decisions as a developer (explain any two benefits of oops)

  1. We can develop the programs from standard working modules that communicate with one another, rather than having to start writing the code from abrasion, which saves development time and advanced productivity.

  2. The benefits of OOPs language allow it to break the program into bit-sized problems that can be answered fluently (one object at a time).

  3. The new technology promises higher programmer productivity, better software, and lower conservation costs.

  4. The benefits of OOPs systems can be fluently upgraded from small to large systems.

  5. Multiple cases of objects may co-occur without any embarrassment.

  6. It’s easy to partition the work into a design grounded on objects.

    Conclusion

    OOPs is the human experience. Each day we interact with countless objects. We very intuitively deal with objects. OOP just acknowledges that human reality. Object-oriented programming revolves around the concepts of objects and classes. In Java, the classes are referred to as templates for the objects while the objects are instances of a class sothe objects can inherit all the class's characteristics, variables, and functions.

0
Subscribe to my newsletter

Read articles from Anjali Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anjali Gupta
Anjali Gupta