Legacy C++ (C++98/03)
The classic language: pointers, classes, templates, the STL and the idioms of the pre-C++11 era.
1. Getting Started
- Program Structure and Compilation beginner
main(), headers, the compile-link process and your first program.
- Variables, Types and Literals beginner
Fundamental types, sizes, signed/unsigned, literals and conversions.
- Operators and Expressions beginner
Arithmetic, logical, bitwise operators, precedence and evaluation order.
- Control Flow beginner
if, switch, for, while, do-while, break, continue and goto.
- Functions beginner
Parameters, return values, overloading, default arguments and inline functions.
- Scope, Storage Duration and Linkage intermediate
Block/file scope, static, extern, and the One Definition Rule.
2. Pointers, References and Memory
- Pointers and References beginner
How pointers and references name objects indirectly, and when to choose each.
- Arrays and C Strings beginner
Built-in arrays, pointer arithmetic, char arrays and <cstring>.
- Dynamic Memory: new and delete intermediate
Heap allocation, new[]/delete[], leaks and placement new.
- const Correctness intermediate
const objects, pointers, references, const member functions and mutable.
- Preprocessor and Header Files beginner
#include, #define, include guards, macros and their dangers.
3. Classes and Object-Oriented Programming
- Classes and Objects beginner
Members, access control, struct vs class and member functions.
- Constructors, Destructors and Initializer Lists beginner
Object lifetime, member initialization order and conversion constructors.
- RAII and the Rule of Three intermediate
Tie a resource's lifetime to an object's lifetime, and know which special members you must write together.
- Operator Overloading intermediate
Overloading arithmetic, comparison, stream and subscript operators.
- friend, static Members and Nested Classes intermediate
Controlled access, class-wide data and helper types.
- Inheritance beginner
Public/protected/private inheritance and constructor/destructor order.
- Virtual Functions and Polymorphism intermediate
Dynamic dispatch, vtables, virtual destructors and slicing.
- Abstract Classes and Interfaces intermediate
Pure virtual functions and interface-style design.
- Multiple and Virtual Inheritance advanced
The diamond problem, virtual base classes and ambiguity.
- RTTI and Casts intermediate
typeid, dynamic_cast, static_cast, const_cast and reinterpret_cast.
4. Templates and Namespaces
- Function Templates intermediate
Generic functions, template argument deduction and overloading.
- Class Templates intermediate
Generic classes, member templates and dependent names.
- Template Specialization advanced
Full and partial specialization, and basic traits techniques.
- Namespaces beginner
Organizing names, using-declarations and the ADL rules.
5. Exceptions, Strings and I/O
- Exceptions intermediate
try/catch/throw, stack unwinding and exception specifications.
- Exception Safety advanced
Basic, strong and no-throw guarantees and how to achieve them.
- std::string beginner
Construction, searching, modification and conversion.
- Streams and Formatting beginner
cin/cout, manipulators and stringstream.
- File I/O beginner
ifstream/ofstream, text vs binary, seeking and error states.
6. The Standard Template Library
- Sequence Containers beginner
vector, deque and list, and how to choose between them.
- Associative Containers intermediate
set, map, multiset, multimap and ordering requirements.
- Iterators intermediate
Iterator categories, invalidation rules and iterator adaptors.
- Algorithms intermediate
sort, find, transform, accumulate and the erase-remove idiom.
- Function Objects and Binders intermediate
Functors, predicates, bind1st/bind2nd and mem_fun.
7. Idioms and Patterns
- std::auto_ptr C++98 intermediate
The C++98 smart pointer: single ownership via copy-that-moves, and the pitfalls that led to its replacement.
- The Pimpl Idiom advanced
Hide implementation details and cut compile-time dependencies.
- The Copy-and-Swap Idiom advanced
Exception-safe assignment operators.
- Smart Pointers before C++11 (Boost) intermediate
scoped_ptr, shared_ptr and weak_ptr as used in the C++03 era.