Last Updated:

Are C not enough for you? Try C++

C++ is C with classes

 

When C was released in 1973, it was cool – you could write almost any system program in a high-level language without any assembly. And at first, it was enough for everyone.

But then one developer wanted to use the full power of OOP, but the language did not directly support it. Then he found a way out - he wrote his version of the C language with support for objects, classes and methods, which was originally called "C with classes".

At first, it was like just a superstructure over standard C, and there was even a compiler that translated this code into ordinary code in C. But over time, the language became more complicated, increasingly departed from the concept of the usual C, and in 1983 it became a separate full-fledged language with its own capabilities and features. At the same time, it had the name C++ .

What is the strength of C++

 

C++ inherited from C all its strengths and added new ones:

  • full-fledged OOP programming;
  • overloading operators (in skillful hands this is a very powerful thing);
  • full-fledged exception handling (this is when you think in advance what can go wrong, and manage to foresee the behavior of the program in case of errors);
  • some automation when working with memory.

Disadvantages of C++

It may seem that compared to C, C++ has more drawbacks, but this is not so - they are simply different and arose for other reasons. Here are some of them:

  • It has become even easier to make a mistake that will lead to incorrect operation of the program or to its fall.
  • Improper use of referencing, pointer and overload mechanisms is difficult to catch during the error search phase.
  • Built-in ways to bypass compiler limitations produce unpredictable results (although, again, this is sometimes useful).
  • An OOP implementation can reduce the performance of your code by several percent. Sometimes it's critical.
  • It is difficult to write cross-platform code so that it can be easily ported to other platforms.
  • To reach the full potential of C++, you need to know the language really well, otherwise there will be no gain in speed or efficiency.

What is being written in C++ now

In C++ they write the same thing as in C - system applications, drivers, operating systems and software for embedded systems. But thanks to OOP, the scope of C++ turned out to be slightly wider than that of C. Here's what is written in C++:

  • almost all Adobe products (Photoshop, Illustrator, inDesign, Acrobat, and so on);
  • almost all major Microsoft products (Windows, Office, IE, Visual Studio, SQL);
  • most of macOS (including the Finder interface)
  • iPod interface;
  • Autodesk applications for designers;
  • high-load components of the Facebook platform;
  • Google search, Chromium engine;
  • Havoc is a realistic physics engine that is used in games;
  • software for on-board computers of Lockheed aircraft (Stealth, for example);
  • firmware for MAN engines — tractors;
  • most of the medical software of Siemens.

And here's a part of the games that are also written in C++ (or the engines for these games are written in C++):

  • Doom III engine;
  • Football Pro;
  • Kings Quest;
  • Antara;
  • SWAT;
  • StarCraft;
  • Diablo II: Lord of Destruction;
  • Warcraft III;
  • World of Warcraft.