C++

A powerful systems language extending C with object-oriented features, templates, and zero-overhead abstractions.

Object-Oriented
Procedural
Functional
Generic
Advanced
1985
Bjarne Stroustrup

Overview

C++ is a general-purpose programming language created as an extension of C. It has imperative, object-oriented, and generic programming features while also providing facilities for low-level memory manipulation. Modern C++ (C++17/20/23) has evolved significantly, offering smart pointers, lambda expressions, concepts, ranges, and modules that make it both safer and more expressive while maintaining its performance edge.

Key Features

  • Zero-overhead abstractions — Templates and inlining eliminate runtime cost of abstractions
  • RAII — Resource Acquisition Is Initialization for deterministic resource management
  • Templates & generics — Compile-time polymorphism and metaprogramming
  • Standard Template Library (STL) — Rich containers, algorithms, and iterators
  • Multi-paradigm — Supports OOP, procedural, functional, and generic styles

Code Example

cpp
#include <iostream>
#include <vector>
#include <algorithm>
#include <ranges>

int main() {
    std::vector<int> nums = {5, 3, 8, 1, 9, 2, 7};

    auto evens = nums
        | std::views::filter([](int n) { return n % 2 == 0; })
        | std::views::transform([](int n) { return n * n; });

    for (int n : evens) {
        std::cout << n << " ";
    }
}

Learning Resources

Learning Path

23 topics across 5 sections

1Basics

C++ fundamentals building on C knowledge.

  • Introduction to C++ — C vs C++, compilers, and the C++ standards timeline
  • Variables & Types — auto, decltype, references (&), const, and constexpr
  • Namespaces — namespace, using declarations, and avoiding name collisions
  • I/O Streams — cin, cout, cerr, stringstream, and formatting
  • Control Flow — Range-based for, structured bindings, and if-with-initializer

2OOP in C++

Classes, inheritance, and polymorphism.

  • Classes — Constructors, destructors, member functions, access specifiers
  • Inheritance — Single, multiple, virtual inheritance, and diamond problem
  • Polymorphism — Virtual functions, vtable, pure virtual, override, final
  • Operator Overloading — Overloading arithmetic, comparison, I/O, and subscript operators
  • RAII — Resource Acquisition Is Initialization — deterministic cleanup

3Templates & Generic Programming

Compile-time polymorphism and metaprogramming.

4STL

The Standard Template Library — containers, algorithms, iterators.

  • Containers — vector, map, unordered_map, set, deque, array
  • Algorithms — sort, find, transform, accumulate, and ranges (C++20)
  • Iterators — Iterator categories, begin/end, and reverse iterators
  • Smart Pointers — unique_ptr, shared_ptr, weak_ptr, and make_unique/shared

5Modern C++ (17/20/23)

Latest features for safer, more expressive code.