The main goal of C++ programming is to introduce the concept of Object-Oriented Programming and add some features to C programming.
Many concepts such as inheritance, data binding, polymorphism, and many more are available in Object-Oriented Programming.
True object-oriented programming is a programming paradigm in which everything is represented as an object. Smalltalk is widely regarded as the world’s first object-oriented programming language.
OOPs (Object Oriented Programming System):
An object is a physical entity such as a pen, chair, or table. Object-Oriented Programming (OOP) is a programming methodology or paradigm that creates programs through the usage of classes and objects. It describes a bunch of concepts that make software development and maintenance easier.
Books And Laptop:
An object is any entity that has a state and behaviour. For example, a chair, a pen, a table, a keyboard, a bicycle, and so on. It might be both physical and logical in nature.
The collection of objects is called class. It is a logical entity.
When one object inherits all of the parent object’s properties and behaviours, this is referred to as inheritance. It allows for code reuse. It’s utilised to achieve polymorphism at runtime.
Polymorphism occurs when one task is accomplished in multiple ways. For instance, to convince the buyer in a different way, draw something, such as a form of a rectangle.
To implement polymorphism in C++, we utilize Function overloading and Function overriding.
Abstraction is the process of hiding internal features while displaying functionality. We don’t know the internal processes of a phone call, for example.
To achieve abstraction in C++, we utilize abstract classes and interfaces.
Encapsulation is the process of combining (or encapsulating) code and data into a single entity. For instance, a capsule is wrapped in many drugs.
Advantage of OOPs over Procedure-oriented programming language
- OOPs simplifies development and maintenance, whereas Procedure-oriented programming languages are difficult to handle as projects expand in size.
- Data hiding is provided by OOPs, whereas a global data can be accessible from anywhere in a Procedure-oriented programming language.
- OOPs greatly improve the ability to replicate real-world events. If we use the Object-Oriented Programming language, we may deliver a solution to a real-world problem.