Oops Concept in C++
Oops Concept in C++
The main purpose of C++ programming was to add object orientation to the C programming language, which is in itself one of the most powerful programming languages. If any programming language follow below oops concept then that language called object oriented programming language.
- Object
- Class
- Encapsulation
- Abstraction
- Inheritance
- Polymorphism
Object
Object is the physical as well as logical entity where as class is the only logical entity.It is a basic unit of Object-Oriented Programming and represents the real-life entities. A C++ program creates many objects which interact by invoking methods.
Class
Class: Class is a blue print which is containing only list of variables and method and no memory is allocated for them. A class is a group of objects that has common properties.A class is a user-defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type.
Encapsulation
Encapsulation is a process of wrapping of data and methods in a single unit is called encapsulation. Encapsulation is achieved in C++ language by class concept. The main advantage of using of encapsulation is to secure the data from other methods, when we make a data private then these data only use within the class, but these data not accessible outside the class.
Abstraction
Abstraction is the concept of exposing only the required essential characteristics and behavior with respect to a context.
Hiding of data is known as data abstraction. In object oriented programming language this is implemented automatically while writing the code in the form of class and object.
Inheritance
The process of obtaining the data members and methods from one class to another class is known as inheritance. It is one of the fundamental features of object-oriented programming.
Polymorphism
The process of representing one Form in multiple forms is known as Polymorphism. Here one form represent original form or original method always resides in base class and multiple forms represents overridden method which resides in derived classes.
Note: All these concept I will discuss in detail later.