C++ is an Object-Oriented Programming Language, which is its main feature. It can create and destroy objects while programming. As it is an enhancement to C, hence it possesses all the features offered by C along with its new important feature (Object-Oriented Programming, operator overloading, error handling, etc).
What are the Features of C++ programming Language?
- Object-Oriented Programming (OOP)
- Simple
- Platform or Machine Dependent/Portable
- High-Level Language
- Multi-paradigm programming language
- Case Sensitive
- Compiler based
- Speed
- Rich in Library
- Memory Management
- Pointer and Recursion
1. Object-Oriented Programming (OOP)
C++ is an Object-Oriented Programming Language and it is its main feature. It provides a modular structure for programs that means OOP divides the program into a number of objects and makes it simpler and easier for maintainance which is not provided in Procedure-oriented programming language such as C. Therefore understanding OOP is an important step to learn Java Programming.
C++ follows four main concepts of OOP those are abstraction, data encapsulation, data hiding, and polymorphism.
2. Simple
It is a simple programming language in the sense of a structured approach that is the program can be broken down into parts and can be resolved modularly. This helps the programmer to recognize and understand the problem easily.
3. Platform or Machine Independent/Portable
Platform Dependent language refers to those languages that are executed only on that operating system where it is developed but cannot be executed on any other Operating system. And C++ is of those languages.
Although portability refers to using the same piece of code on various environment with little or no change.
4. High-Level Language
C++ is a high Level language, making it easier to understand as it is closely associated with the human-comprehensible language that is English.
It also supports the feature of low-level language that is used to develop system applications such as kernel, driver, etc. That is why it is also known as mid-level language as C++ has the ability to do both low-level & high-level programming.
5. Multi-paradigm programming language
C++ is a language that supports object-oriented, procedural and generic programming. It supports at least 7 different styles of programming. This makes it very versatile.
6. Case Sensitive
Similar to C, C++ also treats the lowercase and uppercase characters in a different manner. For example, the keyword “cout’ (for printing) changes if we write it as ‘Cout’ or “COUT”. But this problem does not occur in other languages such as HTML and MySQL.
7. Compiler-based
C++ is a compiler-based programming language, unlike Java or Python which are interpreter-based. This feature makes C++ comparatively faster than Java or Python language.
8. Speed
It is a compile-based, hence the compilation and execution time of C++ language is fast.
9. Rich in Library
C++ offers a library full of various in-built function that makes the development with C++ much easier and faster. These functions are present in the various header files and header files are included at the beginning of the program depending on which function the programmer needed to use.
Some of the header files used in C++:
<iostream> | Contains C++ standard input and output functions |
<cmath> | Contains math library functions |
<ctime> | Contains function for manipulating the time and date |
<fstream> | Contains function for functions that perform input from files on disk and output to files on disk |
10. Memory Management
C++ has this feature that allows us to allocate the memory of a variable in run-time. This is known as Dynamic Memory Allocation. There is a function called free() that allows us to free the allocated memory.
11. Pointer and Recursion
Unlike Java, C++ supports pointers for direct interaction with the memory. Pointer is used for memory, structures, functions, array etc. It provides various solution for the memory related problems in a program.
It provides code reusability for every function that is the recursion.