What are the top 10 features of C++?
Features of C++
C++ is an upgraded version of C programming. The main idea behind creating C++ programming was to add object orientation to the C programming language. The major upgradations are object-oriented programming methodology, namespace feature, operator overloading, error & exception handling. The motivation behind object-oriented programming is to try to see the whole world in the form of classes & objects.
There are various features of C++ such as,
- Object Oriented
- Simple
- Platform Dependent
- Mid-level programming language
- Structured programming language
- Rich Library
- Memory Management
- Powerful & Fast
- Pointers
- Compiler based
- Syntax based language
Let’s discuss each one of them one by one.
Object Oriented Programming language
The main upgradation from C to C++ is object-oriented programming. It follows concept of oops like polymorphism, inheritance, encapsulation, abstraction. This makes development and maintenance easier.
Let’s briefly understand the concepts of object-oriented programming.
- Class: 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.
- Object: 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.
- Polymorphism: Polymorphism refers to the ability of OOPs programming languages to differentiate between entities with the same name efficiently.
- Inheritance: Inheritance is the mechanism in which one class is allowed to inherit the features (fields and methods) of another class.
- Encapsulation: Encapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code and the data it manipulates.
- Abstraction: Data Abstraction is the property by virtue of which only the essential details are displayed to the user. The trivial or the non-essentials units are not displayed to the user.
Features of C++: Simple
C++ provides a approach wherein you can break the problem into parts and design the solution modularly. It provides you a rich set of library functions that you can use while implementing the solution.
If you have worked with C language, then moving to C++ would be a very smooth transitioning. The syntax is almost similar with minute changes.
Platform Dependent
Platform dependent language means the language in which programs can be executed only on that operating system where it is developed & compiled. It cannot run or execute it on any other operating system.
C++ is a platform-dependent language. Having said that, C++ programs can be executed in many machines with little bit or no change.
Mid-level programming language
C++ has the ability to do both low-level & high-level programming. This is the reason why C++ is known as a mid-level programming language. When we talk about low-level programming, C++ is used to develop system applications such as the kernel, driver, etc.
Structured programming language
In C++ programming, the code is modular with the help of functions, classes & objects, and the modules are loosely coupled. Modular code is easy to understand & modify. This makes C++ a structured programming language.
Rich Library
Developers have access to lots of in-built functions provided by C++ language. This saves time & makes development fast. Let’s look at some of the C++ header files & functionalities provided by it.
<iostream>
: Contains C++ standard input and output functions<iomanip>
: Contains stream manipulators that format streams of data<cmath>
: Contains math library functions<cstdlib>
: Contains function for conversions of numbers to text and vice versa, memory allocation, random numbers and various other utility 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<memory>
: Contains classes and functions used by the C++ Standard Library to allocate memory to the C++ Standard Library containers<iterator>
: Contains classes for accessing data in the C++ Standard Library containers<algorithm>
: Contains functions for manipulating data in C++ Standard Library containers
Memory Management
C++ supports dynamic memory allocation. You can free the allocated memory at any time. Not only this C++ also provides dynamic memory management techniques.
Powerful & Fast
C++ is a fast language as compilation and execution time is less. Also, it has a wide variety of data types, functions & operators.
Pointers
Pointers are variables that store the address of another variable. Pointer points to the memory location of a variable. C++ supports pointer and provides solutions to lots of problems that demand access to memory location.
Compiler based
C++ is a compiler-based programming language. Without compilation, no C++ program can be executed. The compiler first compiles the C++ program and then it is executed.
Syntax based language
C++ is a language that complies strongly with syntax. Language following rules and regulations very strictly is known as tight syntax-based language. C, C++, Java, .net are some of the examples.
Now I hope you would have understood different features provided by C++. I hope this blog is informative and added value to you.
Thus we have come to an end of this article on ‘Features of C++’. If you wish to learn more, check out the Java Training by Edureka, a trusted online learning company. Edureka’s Java J2EE and SOA training and certification course is designed to train you for both core and advanced Java concepts along with various Java frameworks like Hibernate & Spring.
Got a question for us? Please mention it in the comments section of this blog “C++ features” and we will get back to you as soon as possible.
Source: Edureka