Glossary¶
Every term this course uses, defined precisely, grouped by the module that introduces it, with a final section for the vocabulary of errors, linking and debugging. Links lead to where the term is taught.
A definition here is deliberately short. If a one-line definition is not enough — and for terms like object slicing it usually is not — follow the link.
How to use this page: when a term stops you, look it up here, then read the paragraph it came from again. If it is still unclear, that is the module page you should revisit.
Module 1 — C++ and the OOP mindset¶
- Abstraction — exposing what something does while hiding how it does it.
- Class — a user-defined type; a blueprint for objects.
- Compilation — translating one translation unit into machine code.
- Dependency — the weakest relationship between types: one is simply used by the other.
- Encapsulation — keeping data and the operations on it together, and controlling access to the data.
- Inheritance — defining a new type in terms of an existing one.
- Linking — joining compiled units and libraries into an executable, resolving every name used but defined elsewhere.
- Namespace — a named scope that qualifies identifiers; the standard library
uses
std. - Object — one instance of a class, with its own copy of the data members.
- Object-oriented decomposition — splitting a program into things that own their data and behaviour.
- Polymorphism — one interface, several behaviours.
- Preprocessing — text substitution before compilation;
#includepastes a file in, macros are replaced. - Procedural decomposition — splitting a program into actions (functions).
- Translation unit — one source file after preprocessing: everything the compiler actually sees.
- Undefined behaviour — behaviour the C++ standard places no requirements on. It may crash, print nonsense, or appear to work. "It ran fine" is not evidence of correctness.
Module 2 — Classes and objects¶
- Access specifier —
public,privateorprotected: who may use a member. - Aggregate initialisation — brace-initialising a simple
struct's members in order without writing a constructor. const_cast— the cast that removesconst. Almost always a bug or a design smell; the one legitimate use is an object that is logically const but physically mutable, which is whatmutable(Module 4) is for.- Data member — a variable belonging to each object of a class.
- Declaration vs definition — a declaration says a thing exists; a definition gives it storage or a body.
- Header guard /
#pragma once— prevents a header being pasted twice into one translation unit. - Interface — the public members: everything a caller may depend on.
- Member function — an operation belonging to a class, with implicit access to the object it was called on.
structvsclass— identical except default member access (publicforstruct,privateforclass) and default inheritance mode.this— a pointer to the object a member function was called on.
Module 3 — Constructors and destructors¶
- Constructor — a member function with the class's name and no return type, run automatically on creation.
- Default constructor — callable with no arguments. Declaring any other constructor suppresses the implicitly generated one.
- Delegating constructor — one constructor calling another of the same class.
- Destructor —
~ClassName(), run automatically when an object's lifetime ends. explicit— blocks the use of a single-argument constructor as an implicit conversion.= default/= delete— request or forbid a compiler-generated member function, explicitly.- Initialisation vs assignment — initialisation happens once, at creation; assignment happens afterwards, to an object that already exists.
- Invariant — a property that must hold for every valid object. Established by constructors and preserved by the public interface.
- Member initialiser list — initialisation performed before the constructor
body; the only way to initialise
constand reference members. - Object lifetime — an object begins to exist when it is created and stops existing at the end of its scope; this is what ties constructors to destructors.
- Temporary — an unnamed object created during expression evaluation.
Module 4 — Encapsulation¶
- Cohesion — how single-mindedly a class does one job.
constmember function — promises not to modify the object, and may therefore be called on aconstobject.const-correctness — marking everything that can beconstasconst, so unintended modification becomes a compile error.- Coupling — how much one part of a program must know about another.
friend— grants one specific function or class access to private members.- Information hiding — a caller cannot depend on what it cannot see.
mutable— allows a member to change inside aconstmember function. Rare and usually a signal of a design problem.- Overloading on
const— providing bothconstand non-constversions of one member function. static_cast— the cast for a conversion the compiler can check: between arithmetic types, or a pointer up or down a hierarchy whose type you have already established. No run-time check is performed.
Module 5 — Operators and static members¶
- Conversion operator —
operator T(), allowing implicit or explicit conversion to another type. - Functor — a class with
operator(), making its objects callable. operator<<— the stream-insertion operator; overloaded as a free function returningstd::ostream&so chaining works.- Operator overloading — defining special behaviour for an operator on your own types. At least one operand must be of class or enumeration type.
- Self-assignment —
a = a; harmless for simple types, fatal for a class that frees before copying. staticdata member — one storage location per class, shared by all objects.staticmember function — belongs to the class, has nothis, and cannot beconst.- Strict weak ordering — the requirement a comparator must satisfy for
std::sortand ordered containers to behave correctly.
Module 6 — Inheritance¶
- Base class / derived class — the general class, and the one defined in terms of it.
- Diamond problem — two bases sharing a common ancestor give a class two copies of that ancestor's members, making inherited names ambiguous.
enum class— a scoped enumeration with its own type; its enumerators do not leak into the surrounding scope, and it is the kind of tag [Module 7] names as the alternative an interface should replace.- Fragile base class — a base whose implementation leaks into derived classes, so changing the base breaks derived code.
- Inheriting constructors —
using Base::Base;, making base constructors available in the derived class. is-a— the test that justifies inheritance. A book is a lendable item; a library has books.- Multiple inheritance — deriving from more than one base.
- Name hiding — a derived member with the same name hides all base members of
that name;
Base::member()reaches the hidden one. protected— accessible to the class and its derived classes, not to outside callers. A strong coupling decision.- Virtual inheritance — makes a diamond share a single subobject of the common base.
Module 7 — Polymorphism¶
- Dynamic binding — the function called is resolved at run time from the
object's actual type. Requires
virtual. dynamic_cast— a checked downcast: it succeeds only if the object really is of the target type, and returns a null pointer or throws otherwise. It exists, and needing it usually means an interface is missing an operation.- Object slicing — initialising a base-class object from a derived-class one copies only the base part; the derived data and behaviour are silently lost.
- Override — a derived function matching a virtual base function's name,
parameters and
const-qualification. override— an annotation requiring the compiler to verify that a function really does override something.final— forbids further overriding of a function, or deriving from a class.- Polymorphic container — a container of base-class pointers, typically
std::vector<std::unique_ptr<Base>>, holding objects of several derived types. - Static binding — the compiler decides which function to call, from the static type of the expression. The default.
- Virtual destructor — a destructor declared
virtualso that deleting through a base pointer destroys the whole derived object. virtualfunction — a member function whose implementation is selected at run time.- vtable / vptr — the usual implementation of dynamic dispatch: a table of function pointers per class and a hidden pointer per object. A typical implementation, not a language guarantee.
Module 8 — Abstract classes¶
- Abstract class — a class with at least one pure virtual function; it cannot be instantiated.
- Concrete class — a derived class overriding every inherited pure virtual function, and therefore instantiable.
- Design by contract — stating what a function requires of its caller (preconditions) and guarantees on return (postconditions).
- Interface — an abstract class with no data members and only pure virtual functions, plus a virtual destructor.
- Interface segregation — preferring several narrow interfaces to one wide one.
- Non-virtual interface (NVI) — a public non-virtual function that calls a private virtual one, letting the base control the surrounding logic.
- Pure virtual function — declared
= 0; must be overridden by a concrete class.
Module 9 — Composition and association¶
- Aggregation — a has-a relationship to something that exists independently; non-owning.
- Association — a general "knows about" link, often for one operation only.
- Composition — a has-a relationship where the part is owned: if the whole dies, the part dies.
- Encapsulating a collection — keeping a container private and exposing queries, so the invariant spanning it cannot be broken from outside.
- Forward declaration —
class Item;, naming a class without including its header. Enough for references and pointers, not for value members. - Include cycle — two headers including each other; the cause of confusing
does not name a typeerrors. - Law of Demeter — talk to your immediate collaborators, not to their internals.
- Multiplicity — how many objects participate in a relationship: one, optional one, or many.
- Ownership — the responsibility for an object's lifetime. Exclusive by default; shared only deliberately.
Module 10 — Copying and resource management¶
- Copy assignment —
operator=, replacing an existing object's contents. - Copy constructor — constructs a new object as a copy of an existing one:
T(const T&). - Copy elision — the compiler constructing an object directly where it is needed, so no copy occurs. Guaranteed in C++17 initialisation from a prvalue.
- Copy-and-swap — building a correct copy then swapping it into place; gives self-assignment safety and the strong exception guarantee.
- Deep copy — allocating and copying the pointed-to resource, so the two objects are independent.
- Double free — two owners deleting the same resource. Undefined behaviour.
- lvalue / rvalue — loosely, an expression that names something persisting, versus a temporary or a value being moved from.
- Move constructor / move assignment — taking over another object's resources:
T(T&&)andT& operator=(T&&). - Moved-from state — valid but unspecified. Never assume it is empty; do assume it can be destroyed and reassigned.
noexceptmove — a move operation that cannot throw. Containers use it during reallocation, and copy instead when it is absent.- Rvalue reference —
T&&; binds to rvalues and makes move operations selectable. - Rule of Three — if you need a destructor, copy constructor or copy assignment, you almost certainly need all three.
- Rule of Five — the Rule of Three plus move constructor and move assignment.
- Rule of Zero — the goal: own no resource directly, and declare none of the five.
- Shallow copy — copying a pointer rather than what it points at.
- Special member functions — the default constructor, copy and move constructors, copy and move assignment operators, and the destructor.
std::move— a cast to an rvalue reference. It moves nothing by itself.
Module 11 — RAII and smart pointers¶
- Control block — the bookkeeping structure behind a
shared_ptr(use count, weak count, deleter). - Custom deleter — a callable given to a smart pointer so a non-memory resource is released correctly.
- RAII (Resource Acquisition Is Initialisation) — every resource is owned by an object: acquired in its constructor, released in its destructor.
- Raw owning pointer — a raw pointer whose target you must
delete. A design smell; use a smart pointer so ownership appears in the type. - Reference cycle — two
shared_ptrs owning each other, so neither is ever destroyed.weak_ptrbreaks it. std::make_shared/std::make_unique— factory functions that construct the object (and, forshared_ptr, its control block) without writingnew.std::shared_ptr— shared ownership through a reference count.std::unique_ptr— exclusive ownership; movable, not copyable, and no larger than a raw pointer.std::weak_ptr— observes an object owned byshared_ptrwithout affecting its lifetime.- Stack unwinding — destroying local objects while an exception propagates.
Module 12 — Templates¶
- Class template — one class definition parameterised over a type; the basis of
std::vector,std::map,std::unique_ptr. - Concept (C++20) — a named requirement on a template parameter, producing far clearer error messages. Recognised, not required here.
- Deduction — the compiler working out template arguments from the call.
- Explicit instantiation — asking for a specific instantiation in one
translation unit, allowing the definition to live in a
.cpp. - Function template — one function definition working for many argument types.
- Generic programming — writing algorithms in terms of requirements rather than concrete types; the design philosophy of the STL.
if constexpr(C++17) — compile-time branching inside a template.- Instantiation — generating real code for a specific set of template arguments, at compile time.
- Non-type template parameter — a template parameter that is a value, such as a fixed size.
- Specialisation — providing a different implementation of a template for a particular type.
- Type trait — a small template answering a compile-time question about a type.
Module 13 — Exception handling¶
catch (...)— catches anything. Useful only for cleanup-and-rethrow or at a boundary.- Exception — an object thrown to signal that an operation could not complete.
- Exception safety guarantee — basic (no leaks, object still valid), strong (succeeds or leaves the object unchanged), nothrow (never fails).
noexcept— a promise that a function does not throw. Breaking it callsstd::terminate.- Propagation — an exception travelling outward until a matching handler is found.
- Rethrow —
throw;, re-raising the current exception unchanged. std::exception— the standard base class for exceptions;what()returns a description.- Unwinding — see stack unwinding; it is what makes RAII cleanup reliable.
Module 14 — The STL with OOP¶
- Algorithm — a function template operating on an iterator range.
- Capture — how a lambda takes in surrounding variables: by value
[=], by reference[&], or explicitly. - Comparator — a callable defining an ordering.
- Complexity — how an operation's cost grows with the number of elements.
- Container — an object that stores and owns others: sequence, associative, or unordered associative.
- Iterator — refers to an element and can move between elements; the interface that lets one algorithm work with many containers.
- Lambda — an inline anonymous function object:
[](params) { body }. - Predicate — a callable returning
bool. - Reallocation —
std::vectorgrowing its buffer, moving or copying every element. - Structured binding (C++17) —
for (const auto& [key, value] : map). std::map/std::set— ordered, typically a balanced tree; logarithmic lookup, sorted iteration.std::unordered_map/std::unordered_set— hash-based; average constant-time lookup, no ordering.std::vector— contiguous storage; the default sequence container.
Module 15 — SOLID and design patterns¶
- Adapter — wraps an existing type to present a different interface.
- Decorator — wraps an object to add behaviour while keeping its interface.
- Dependency injection — supplying a collaborator from outside, usually through a constructor.
- Dependency inversion — depend on abstractions, not on concrete details.
- Factory method — a function that creates objects, so callers depend on an interface rather than on concrete constructors.
- Liskov substitution — a derived type must be usable wherever its base is promised, without surprising the caller.
- Observer — lets subscribers be notified of an event without the subject knowing their concrete types.
- Open/closed — open to extension, closed to modification.
reinterpret_cast— reinterprets the bits of a value with no conversion performed. A last resort; no program in this course uses it.- Over-engineering — adding abstraction for a change that has not happened.
- Singleton — a class with exactly one instance and a global access point; frequently an anti-pattern for testability.
- Single responsibility — a class should have one reason to change.
- SOLID — five design principles: single responsibility, open/closed, Liskov substitution, interface segregation, dependency inversion.
- Strategy — encapsulates interchangeable behaviour behind an interface.
- Template method — a base class defines an algorithm's skeleton, with steps supplied by derived classes.
- UML class diagram — standard notation for classes and their relationships: visibility, associations, aggregation, composition, inheritance, multiplicity.
- YAGNI — "you aren't gonna need it"; the counterweight to speculative generality.
Module 16 — Advanced OOP capstone¶
- Anonymous namespace — gives internal linkage: visible only in that translation unit.
- Header/source organisation — declarations in headers, definitions in source files.
- One Definition Rule (ODR) — a function may be declared many times but defined
once. Violating it produces
multiple definitionlink errors. - Open mode —
in,out,app,trunc,binary; combining file-stream modes wrongly is a classic way to destroy data. - Refactoring — improving structure without changing behaviour, made safe by tests.
- Round-trip integrity — save then load reproduces the same state.
- Stream — a source or sink of characters with a state.
- Stream state —
good,fail,eof,bad; checking it is how you notice that reading failed. std::fstream/std::ifstream/std::ofstream— file input and output streams.std::stringstream— an in-memory stream, for parsing and formatting text.- Unit test — an automated check of one behaviour.
Debugging, diagnostics and tools¶
- Access violation — Windows' name for a segmentation fault. The program touched memory it does not own, and the operating system stopped it.
- AddressSanitizer (ASan) — a compiler feature (
-fsanitize=address) that instruments a build to catch out-of-bounds access, use-after-free and leaks at the moment they happen. Available on many toolchains; some MinGW installations cannot link it. - Assertion —
assert(condition);, a claim checked at run time that stops the program if it is false. Disabled whenNDEBUGis defined, so never use one for behaviour the program needs. - Bisect — halving the search space to find a cause: comment out half the code, the half of the files, or the half of the input, and repeat. The standard way to shrink a bug.
- Breakpoint — a point at which a debugger pauses execution so you can inspect state.
- Buffer overflow — writing past the end of an array or buffer. Undefined behaviour, and a common source of crashes that appear somewhere else entirely.
- Call stack — the chain of function calls currently active, with the local state of each. A debugger shows it, and it is what a crash dump is mostly made of.
- Compile error — the compiler refused to translate a translation unit. It names a file, a line and a column, and the fix is local to that file.
- Core dump — a snapshot of a crashed process's memory, written by the operating system for later inspection.
- Crash — the process was stopped by the operating system rather than exiting normally, usually because of undefined behaviour.
- Dangling pointer — a pointer to memory that has been released. Using it is undefined behaviour.
- Debugger — a tool that runs a program under your control: breakpoints, stepping, inspecting variables. Convenient, and not a substitute for shrinking the problem.
- Diagnostic — a message from the compiler or linker. A warning is informational; an error means no output was produced.
- Double free — releasing the same allocation twice. Undefined behaviour, and the classic symptom of two owners of one resource.
- Exit status — the number a process returns when it finishes;
0conventionally means success. In a shell,echo $?shows the last command's status. - Garbage value — the value in a variable that was never initialised. Reading it is undefined behaviour, and it may change between runs.
- Heisenbug — a bug that changes or disappears when you look at it, usually because adding print statements moved memory around. Almost always one of: uninitialised memory, a dangling pointer, or undefined behaviour.
- Heap — the region of memory used by
new/deleteand by the standard containers. Its lifetime is your responsibility; the destructor of an owning object is what ends it. - Initialisation order fiasco — the problem of a global object using another global that has not been constructed yet. One of the reasons classes hold no global state.
- Link error — every translation unit compiled, but the symbols could not be joined into a program: something is missing, or something exists twice. It names no line, because no single file is wrong.
- Live-object counter — a static count incremented in a constructor and decremented in the destructor, printed at the end. A portable way to detect leaks and double destruction.
- Memory leak — memory that was allocated and never released, because the object that owned it was lost. The program keeps running; the resource is gone.
- Minimal reproducible example — the smallest program that still shows the problem. Something to build before asking for help, and half the time the act of building it is the answer.
- Name mangling — the compiler's encoding of a function's full signature into a linker symbol
(
int twice<int>(int)becomes something like_Z5twiceIiET_S0_).nm -Cdemangles it back. nm— the tool that lists an object file's symbols:Ufor undefined (needed from elsewhere),Tfor defined. On a toolchain whose linker does not name the missing symbol, this is how you find it.- Null dereference — using a pointer that holds
nullptr. Usually an immediate crash, which is the good outcome: it is at least visible. - Out-of-bounds access — indexing outside a container or array.
operator[]does not check;at()does and throwsstd::out_of_range. - Regression — a defect that appears in something that used to work. Caused by a change, and caught by keeping the test that failed.
- Rubber duck — explaining the problem out loud to somebody (or something) that knows nothing. The act of explaining forces the reduction you should have done already.
- Sanitizer — a build mode that instruments the program to detect a class of memory or threading errors at run time, such as AddressSanitizer.
- Segmentation fault — the operating system stopped the program because it accessed memory it does not own. Also called a segfault, and reported on Windows as an access violation.
- Stack — the region of memory holding local variables and function call frames. Freed automatically when a scope ends, which is why values on it are the easy part of ownership.
- Stack overflow — exhausting the stack, usually by unbounded recursion. Distinct from a segfault in cause, identical in effect.
- Stale build — running an executable built from older sources. A rebuilt-after-a-change object file that was never relinked is the classic form, and it is why "the bug is still there" is sometimes false.
- Static linking — including library code inside the executable rather than loading it at run time. Removes a class of deployment problems, and is the workaround for a broken dynamic link.
- Symbol — a name in an object file that the linker works with: a function or variable, defined here or needed from elsewhere.
- Undefined reference — the linker's report that a symbol is used but not defined anywhere. The most common link error, and the one that means "you declared it and never wrote it".
- Use-after-free — using memory after it was released. Undefined behaviour: it may appear to work, which is what makes it dangerous.
- Valgrind — a memory-checking tool for Linux and macOS, in the same territory as a sanitizer and with no build changes needed.
- Warning — a diagnostic that did not stop the build. This course promotes them to errors with
-Werror, because almost every warning is a real defect waiting to happen.
Looking for something not here?¶
Terms are added as modules are published. If a term the course uses is missing, or a definition here is unclear or wrong, that is a defect in the course — please report it. See Contributing.
Deliberately out of scope¶
These are real topics that a serious C++ programmer meets eventually. They are not terms this course uses, so defining them here would promise teaching that the modules do not deliver:
| Not covered | Why, and where the course does cover the need |
|---|---|
RTTI — run-time type information, the machinery behind dynamic_cast |
The course teaches interfaces rather than type queries; Module 8 explains that a caller needing the concrete type is a design signal, and Module 7's refactor is the remedy |
| CRTP / static polymorphism — a template that takes its own derived class as a parameter | Module 7 covers run-time dispatch and Module 12 covers generic types; CRTP is a technique for library authors, and nothing in the course needs it |
Placement new |
It separates allocation from construction. Module 11's ownership model (values and smart pointers) is what replaces it in ordinary code |
Variadic templates — template <typename... Ts> |
Module 12 teaches one type parameter and class templates. Variadics are how the standard library implements tools this course uses, such as std::make_unique |
| Name mangling | An implementation detail of how the linker sees overloaded names. Module 1 explains what the linker does and what its diagnostics mean, which is what a student needs from it |
Concurrency — std::thread, std::mutex |
A separate subject with its own hazards, and a course of its own. Nothing in this course's programs is concurrent |
If you think one of these belongs in the course, that is a reasonable argument to make — the repository's Contributing guide says how.