C++The private keyword restricts access to class members to the class's members and friends. In a base clause, it specifies private inheritance. This is a program correctness check, not a memory-security boundary.
Basic · C++23; repository compiler flag, production runtime not attestedC++The protected keyword controls member access or inheritance access. It makes members available to derived classes without exposing them to ordinary outside code, but adds restrictions on the object expression used to access non-static members.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The public keyword specifies public access to class members or public inheritance. A public: section exposes a class interface, while : public Base preserves the public and protected access levels of base-class members.
Basic · C++23; repository compiler flag, production runtime not attestedC++In C++23, register remains a reserved keyword but is not a permitted storage-class specifier. Its former use in declarations was removed in C++17; migration usually only requires removing register.
Basic · C++23; repository compiler flag, production runtime not attestedC++The requires keyword introduces either a clause constraining a declaration or an expression checking requirements on types and operations. Distinguishing these uses helps you write templates whose availability depends on the capabilities of the supplied type.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The return statement ends the current function call and transfers control to its caller. It can also initialize a returned value or reference. It is not equivalent to break: inside a loop, it exits the entire function.
Basic · C++23; repository compiler flag, production runtime not attestedC++The signed keyword specifies a signed integer type. Used alone, signed means int; with short, int, long, and long long it is redundant. However, signed char is a distinct type from both char and unsigned char.
Basic · C++23; repository compiler flag, production runtime not attestedC++The meaning of static depends on the declaration's location: a local variable retains state between calls, a namespace-scope name gets internal linkage, and a class member does not require a separate copy in every object. Storage duration, scope, and linkage are different concepts.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++static_assert checks a constant condition during compilation. A false condition outside the context of a template definition makes the program ill-formed and requires a diagnostic. An optional string literal describes the violated assumption.
Basic · C++23; repository compiler flag, production runtime not attestedC++The struct keyword declares a class type that can combine data and member functions. Unlike class, its default member access and default inheritance are public. Using struct alone does not guarantee that the type is an aggregate.
Basic · C++23; repository compiler flag, production runtime not attestedC++The switch statement transfers control to a case label matching the condition's value, or to an optional default label. Labels do not end a branch: break exits switch, while [[fallthrough]]; marks intentional continuation.
Basic · C++23; repository compiler flag, production runtime not attestedC++The template keyword introduces templates: families of related declarations parameterized by types, values, or other templates. It also appears in explicit specialization, explicit instantiation, and syntax that identifies a dependent member name as a template.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The keyword this points to the object handled by an implicit object member function. It enables explicit member access, distinguishes a data member from a parameter with the same name, and lets a function return the current object by reference.
Basic · C++23; repository compiler flag, production runtime not attestedC++The thread_local keyword gives a variable thread storage duration: each thread has its own instance, retained between function calls. It does not create one shared variable protected against concurrent access.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The throw keyword throws an exception from an expression or rethrows the currently handled exception. Learn the distinction between throw expression; and throw;, how stack unwinding works, and which situations lead to std::terminate.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++`true` is a C++ keyword and a literal of type `bool` representing truth. It is not the integer literal `1`, although promotion to `int` produces `1`. One common use is initializing Boolean variables.
Basic · C++23; repository compiler flag, production runtime not attestedC++The try keyword introduces a block associated with one or more catch handlers. An exception thrown in that block or in a function it calls can transfer control to a matching handler. The function-try-block form also provides handlers for a function body.
Basic · C++23; repository compiler flag, production runtime not attestedC++The typedef keyword gives a type an additional name without creating a distinct type. Declarator syntax also lets it name pointer, array, and function types.
Basic · C++23; repository compiler flag, production runtime not attestedC++The typename keyword declares a template type parameter or indicates that a qualified name denotes a type. These roles are distinct: class can replace typename when declaring a type parameter, but not when disambiguating a name such as T::value_type.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The union keyword defines a class type whose non-static data members share storage. At most one member can be active at a time; correct use requires tracking member lifetimes.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The unsigned keyword specifies an unsigned integer type; unsigned alone means unsigned int. Learn its valid combinations, modulo arithmetic, and the conversion and comparison pitfalls that arise when mixing signed and unsigned types.
Basic · C++23; repository compiler flag, production runtime not attestedC++The using keyword has several distinct uses: it creates type aliases, makes selected declarations available, affects namespace name lookup, and exposes enumerators. Distinguish these forms: not every using declaration creates an alias.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++The virtual keyword has two separate uses: it enables selection of an overriding member function according to an object's dynamic type, and it marks a virtual base class shared within an inheritance hierarchy. Neither mechanism requires the other.
Intermediate · C++23; repository compiler flag, production runtime not attestedC++`volatile` qualifies a type and gives accesses through such expressions observable significance. It can support hardware access under implementation-specific rules, but it provides neither atomicity nor inter-thread synchronization.
Intermediate · C++23; repository compiler flag, production runtime not attested