A free, self-paced textbook in 8 chapters. Read a chapter, then drill it with the 170 companion flashcards using spaced repetition.
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...
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...
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...
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...
The standard library containers fall into three families. Sequence containers preserve insertion order and include vector, deque, list, array, and forward_list. Associative contain...
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)...
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...
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...