C++, a language for fast applications

The C language has been augmented with objects to facilitate the representation of entities to be processed, and code reuse. This has transformed this system language created in 1972, into an higher level language, C++.
Other features have been added over time as templates, tuples, concurency.

C++ was created in 1981 by Bjarne Stroutstrup, who discovered the object orientation in Simula 67 and wanted to add it to the C language while remaining compatible with it and thus preserving its advantages, including portability between systems.C++ programming language for systems

The first ISO standard for the C++ language date of 1998, it is C++ 98. A new version was created in 2011, C++11. With this version that brings nothing to readability and modernity, the language is rooted in its role as a system tool that has been diverted for a time.

It is used as application language thanks to graphical interface such as Qt and GTK. It is wrongly if C++ is still used as an application language apart to those which require a very fast execution. It is clear that it was designed to optimize performances of the computer and certainly not the programmer productivity. Errors that inevitably come with its hard-core and unreadable syntax are paid dearly in time debugging. Used where appropriate, for system tools, it provides undeniable advantages over C, such as RAII, which will be discussed below.

For portable and server-side programming it is replaced by C# on Windows and Java anywhere.
For server scripting it may be challenged by a new language like Go through its reduced compilation time, builtin concurrency, and a library made for that.
Mozilla on the other hand for system programming develops Rust, which want to be memory safe, while Microsoft also offers its solution to replace C by a object-oriented language, M#, designed for security of the code.

Short history of the language

Objects of activities formalized

C++ describes classes into header files, and body of methods into source files. By declaring instances of classes you can reuses sets of variables and methods without to define them again.
Overloading allows to redeclare a method with different parameters but the same name.

Classes inherits one from other and share their methods. Multi-inheritance remains specific to C++, this has not been reused on derived languages.
Over time, the definition of struct has evolved to become equivalent to that of a class, with the difference that a structure is public by default when a class is private by default. Structs can have methods and support inheritance and in fact we can avoid the use of classes entirely in an OO program.

This conceptual model is criticized by Trygve Reenskaug, inventor of the MVC and DCI, for who it is too static and poorly adapted to the reality of processing in which the representation of objects should vary depending on the context. But this drawback is shared by all current object oriented languages except perhaps by those which like Go where inheritance is replaced by composition.​

Managed memory

C++ introduced RAII (Resource Acquisition Is Initialization), the principle that when an object is created and thus a memory area is required, it will be released automatically when the object is destroyed. This avoid the need of a garbage collector and of the free command like in the C language.
The resource can be an object, a class, an instance of file. It is declared in a scope and released when leaving the scope.

Sample of code

Merging and displaying lists:

string s = "demo" + "trail";
int l = s.length();
for(int i = 0; i < l; i++)
{
   char c = s[i];
   printf("%c\n", c);
} 

Tools and documents

Objective C is another object oriented version of the C language, simpler than C++.