Skip to content

Cpp Programming Textbook

A free, self-paced textbook in 8 chapters. Read a chapter, then drill it with the 170 companion flashcards using spaced repetition.

8 chapters · 170 cards · Updated

Chapters

  1. 1Object-Oriented Foundations in C++

    C++ is built around four foundational principles of object-oriented programming: encapsulation, which bundles data and the functions that operate on it together; abstraction, which...

  2. 2Inheritance and Polymorphism

    Inheritance allows a derived class to inherit members from a base class, declared with a colon and access specifier in the derived class header. It promotes code reuse and expresse...

  3. 3Object Lifecycle and Resource Management

    Constructors are special member functions automatically invoked when an object is created. They share the name of the class and have no return type. A default constructor is one th...

  4. 4Templates and Generic Programming

    Templates let you write generic code that works with any type. A function template such as template<typename T> T max(T a, T b) { return (a > b) ? a : b; } defines a famil...

  5. 5Standard Library Containers and Iterators

    The standard library containers fall into three families. Sequence containers preserve insertion order and include vector, deque, list, array, and forward_list. Associative contain...

  6. 6Modern C++ Utilities and Language Features

    Modern C++ introduces a host of utilities that improve expressiveness and safety. Lambda expressions are anonymous function objects defined inline with the syntax [capture](params)...

  7. 7Memory Management, Pointers, and Casting

    Pointers and references are the two ways to refer indirectly to objects. A reference is an alias for another object: an lvalue reference T& binds to a named object, cannot be n...

  8. 8Error Handling, Concurrency, and the Compilation Model

    C++ handles errors through exceptions and the try-catch construct. A try block contains code that may throw, and catch blocks match against thrown exception types; exceptions propa...

← Back to the Cpp Programming deck