As we continue to learn more about C++, we need to have a basic knowledge of the concepts of Object-oriented programming. Below are a few important object-oriented features:
Objects are typically the basic unit of OOP. objects are mainly instances of a class that has data members and uses different member functions to perform tasks.
class is typically the blueprint for an object, as it declares & defines what data variables the object will take, and the type of operations that can be performed on the class's object. A class can be defined as a user-defined data type, however, it also contains functions within it.
It is a way to reuse written code again and again. The class that is inherited is called ‘base class’, and the class that inherits is called a ‘derived class’.
Furthermore, when a derived class inherits a base class, the derived class can use all the functions which are defined in that base class, therefore making the code reusable.
In C++ Data Abstraction helps increase the power of the programming language by creating user-defined data types. It also represents the required information in the program without presenting the details.
With the use of Data Encapsulation, data cannot be accessed directly, instead, it is only accessible through the functions present within the class. It also makes possible an important concept of data hiding. Data Encapsulation is also used for Data Binding. This is because Encapsulation is all about binding data variables and functions together in a given class.
It combines data and functions into a single unit called Class.
Polymorphism is a feature that allows us to create functions with the same name but different arguments, that can perform differently i.e function with the same name, but functioning in a different way; or, it allows you to redefine a function to provide it with a new definition.