Trusted answers to developer questions

What is C++?

Free System Design Interview Course

Many candidates are rejected or down-leveled due to poor performance in their System Design Interview. Stand out in System Design Interviews and get hired in 2024 with this popular free course.

C++ is general-purpose object-oriented programming (OOP) language developed by Bjarne Stroustrup.

Originally, C++ was called “C with classes,” as it had all the properties of the C language with the addition of user-defined data types called “classes.” It was renamed C++ in 1983.

svg viewer

C++ is considered an intermediate-level language, as it includes both high and low-level language features.

Some key benefits of C++ are outlined below:

Self memory management

Using pointers, C++ allows self-memory management, that enhances the execution speed of a program. But it is necessary to explicitly free up the reserved space later on.

The char 'x' takes 1 byte and int 'num' takes 4 bytes in (hypothetical) Memory Addresses.
The char 'x' takes 1 byte and int 'num' takes 4 bytes in (hypothetical) Memory Addresses.

Object-oriented support

Markdown Monster icon

C++ can be coded in C style or object-oriented style. In certain scenarios, it can be coded either way - making C++ a good example of a hybrid language.

High performance

Since C++ allows to manipulate the processor on a lower level, it is quite faster than advanced level languages like Python or C#.

Other essential concepts of C++ include:

  • Polymorphism
  • Virtual and friend Functions
  • Templates
  • Namespaces
  • Pointers

Basic example

The following example shows how to print “Hello World” in C++.

#include <iostream>
using namespace std;
int main()
{
cout << "Hello World";
return 0;
}

RELATED TAGS

cpp
c++
programming
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?