SkillByAIOpen interactive version →

Lesson 1 / 25

What C++ Is and Where It Is Used

Describe C++'s design goals, standards and typical uses.

Performance with abstractions

C++ is a compiled, statically typed, general-purpose language created by Bjarne Stroustrup, starting in 1979 as "C with Classes". Its central idea is zero-overhead abstraction: you can write high-level code with classes, templates and containers, and the compiler turns it into machine code about as efficient as hand-written C, while giving you direct control over memory and hardware when you need it. That makes C++ the language of choice where performance and control matter: game engines (Unreal Engine), browsers (Chrome, Firefox), databases (MySQL, MongoDB), trading systems, embedded and automotive software, compilers, machine-learning runtimes such as the cores of TensorFlow and PyTorch, and competitive programming. C++ is standardised by ISO in regular releases: C++11 (the start of "modern C++": auto, lambdas, move semantics, smart pointers), C++14, C++17 (std::optional, std::variant, structured bindings), C++20 (concepts, ranges, modules, coroutines) and C++23 (std::print, std::expected). This course teaches modern C++, not the older "C with classes" style.

From source to machine code

C++ source is compiled ahead of time to native machine code for each target platform.

Figure 1.1 — Compiling C++ to native code for different platforms.

A first modern C++ program

C++23's std::print, or the classic iostream version.

#include <print>      // C++23
#include <string>
#include <vector>

int main() {
    std::vector<std::string> langs{"C", "C++", "Rust"};
    for (const auto& lang : langs) {
        std::print("Hello from {}!\n", lang);
    }
    return 0;
}

// classic C++ (works with every compiler):
// #include <iostream>
// int main() { std::cout << "Hello, C++!\n"; }

Learn modern C++ first

Many tutorials still teach raw new/delete, C arrays and char* strings first. Start with std::vector, std::string, references and smart pointers; learn the low-level pieces when you need them.

Quick check: Which C++ standard is usually described as the start of "modern C++"?

  • C++11
  • C++98
  • C++03
  • C++23
Answer

C++11 — C++11 introduced auto, lambdas, move semantics and smart pointers, transforming everyday C++.