OOP (Object Oriented Programming) is a programming paradigm that makes use of classes and objects. It’s utilized to break down a software program into reusable code blueprints (called classes) that may be used to build specific instances of things.
Inheritance, hiding, polymorphism, and other real-world concepts are all part of object-oriented programming. The basic goal of OOP is to connect data and the functions that operate on it so that no other part of the code may access it except that function.
A class is a generic template that can be used to make more specialized, concrete things. These classes specify which properties, such as color, an instance of this type will have, but not the value of those attributes for a specific object.
Object Oriented Programming Concept
Object – An object is any entity that has state and behaviour. An Object can used to represent a class instance. An object holds an address and occupies memory space. Objects can communicate even if they are unaware of one other’s data or code.
Class – The term “class” refers to a group of items. It’s a logical thing. A class can alternatively be thought of as a blueprint from which an individual object can be created. Class doesn’t take up any room.
Method – Methods Can change the status of a class that affects all instances of the class.
Encapsulation – Encapsulation is achieve when each object within a class retains a private state. Other objects can’t access this state directly; instead, they have to use a list of public functions. These functions provide the object authority over its own state, which no other class may change unless it is explicitly permit.
Inheritance – Inheritance occurs when one object inherits all of the characteristics and actions of a parent object. It allows for code reuse. This is uses to achieve polymorphism at runtime.
Abstraction – Encapsulation is an extension of abstraction. It is the process of picking data from a bigger pool in order to display only the object’s relevant details. One of the benefits of Abstraction is that you can reuse the same information you used for the dating app in other apps with little or no changes.
Polymorphism – Polymorphism allows us to utilize a class that is identical to its parent, avoiding type confusion. As a result, each child subclass has its own set of functions and methods.
Interested in learning about similar topics? Here are a few hand-picked blogs for you!
- What is constructor?
- How does computer software work?
- What is compiler?
- Explain recursion?
- What is memory?