C++ for cpp_piscine

Documentation on C++ for cpp_piscine

Follow @donadoio

C++ for cpp_piscine

What is C++?

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.

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

Useful concepts & subtopics below

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.
C++ Memory management

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

C++ Object Oriented Programming
C++ Object Oriented Programming

Object-oriented support

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