What Is a Type Alias in C++? using vs typedef
A C++ type alias is a new name for an existing type. See using vs typedef, alias templates and why aliases do not create distinct types.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
A C++ type alias is a new name for an existing type. See using vs typedef, alias templates and why aliases do not create distinct types.
Learn how C++ bit fields pack flags and small counters into a struct, what the rules and portability limits are, and when std::bitset is better.
A C++ union shares one memory block among its members. See the rules, non-trivial members, and why std::variant is usually better.
A null pointer refers to no object. Learn nullptr, safe checks, why dereferencing is undefined behavior and which modern C++ types replace raw pointers.
A function pointer in C++ stores a function's address so you can call it indirectly, pass callbacks and build dispatch tables. Compare it with std::function.
RAII binds a resource to an object so the destructor always releases it. See a move-only file wrapper, standard RAII types and common pitfalls.
A C++ destructor releases an object's resources automatically. See when it runs, how to write one, and the rules for virtual destructors and RAII.
A private virtual function in C++ can be overridden by derived classes but called only from the base class. Covers rules, NVI and when to use protected instead.
The diamond problem gives a C++ class two copies of a shared base and ambiguous member access. Virtual inheritance fixes it; see examples and constructor rules.
Constructor chaining lets one C++ constructor call another through the member initializer list. Learn the syntax, restrictions and how it differs from inheritance.
A C++ class marked final cannot be inherited. See the syntax, how final virtual functions work and when sealing a class makes sense.
The final specifier stops a C++ class from being inherited or a virtual function from being overridden. Learn the syntax, errors, std::is_final and when to use it.
An abstract class in C++ declares at least one pure virtual function and defines an interface for derived classes. Learn the syntax, rules and a C++20 example.
Learn what a static member function is in C++, how to call it, what it can access, and when factories and utilities should use it.
A static variable in C++ is created once and lives until the program ends. See how static locals, static class members and internal linkage differ.
Learn the two meanings of static on a C++ function: static member functions tied to a class, and file-level functions with internal linkage.
In modern C++, inline mainly allows a function to be defined in headers without ODR errors; the compiler decides whether to substitute the body.
Stack objects are automatic and fast, heap objects are dynamic and need an owner. See RAII, smart pointers, a comparison table and common pitfalls.
volatile makes every access to a variable observable, which suits hardware registers and signal flags. It does not make code thread safe.
A reference variable is an alias for an existing object. See the initialisation rules, const references, pass by reference and how they differ from pointers.