CPP Modules

A comprehensive series of C++ projects exploring Object-Oriented Programming concepts, memory allocation, templates, and STL.

2022-01-01

CPP Modules

CPP Modules

Nine modules covering C++ from the ground up, all written in C++98. The progression is designed for people coming from C, starting with basic class syntax and working up to templates, STL, and multiple inheritance.

Modules

ModuleTopic
00Namespaces, classes, member functions, streams
01Memory allocation, references, pointers to members
02Operator overloading, Orthodox Canonical Form
03Inheritance, diamond problem
04Virtual functions, abstract classes, interfaces
05Exception handling with custom exception hierarchies
06C++ casts: static, dynamic, reinterpret, const
07Function and class templates
08STL containers, iterators, and algorithms

Things worth noting

The Orthodox Canonical Form comes up early and stays relevant throughout. Every class needs a default constructor, copy constructor, copy assignment operator, and destructor.

Module 02 builds fixed-point arithmetic from scratch using operator overloading, which is a good way to really understand how it works. Module 06 gets into RTTI and when dynamic_cast is actually appropriate vs just being a code smell.

Build

Each exercise has its own Makefile:

cd module_00/ex00
make
./megaphone "hello" "world"

SCREENSHOTS // 01 FRAMES

Screenshot 1
01 / 01