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
- Modularity
Object
Object is the physical as well as logical entity where as class is the only logical entity.
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.
Encapsulation (for more details click here)
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 (for more details click here)
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 (for more details click here)
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 (for more details click here)
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.
Modularity (for more details click here)
It is the property of a system that has been decompose into a set of cohesive and loosely coupled modules.
- It reduces complexity to some degree .
- It creates a number of well define,documented boundaries within a program.