Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C++

Knowledge base — C++

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 674

C++

else — the alternative branch of an if statement

The else keyword introduces an optional branch of an if statement, selected when the condition is false. The spelling else if nests another if; braces make branch association explicit.

Basic · C++23; repository compiler flag, production runtime not attested
C++

enum — enumeration type

The enum keyword defines a distinct type with named constants. Learn the differences between enum and enum class, value numbering, and underlying-type selection.

Basic · C++23; repository compiler flag, production runtime not attested
C++

explicit — controlling implicit conversions

The explicit specifier restricts constructors and conversion functions in implicit conversions while preserving deliberate object construction. Learn the distinction between direct- and copy-initialization, the special role of operator bool, and conditional explicit(condition).

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

export — exposing a module interface

The `export` keyword marks a module interface unit, exposes declarations to importers, or re-exports an import. Writing `export module M;` alone does not automatically export all subsequent declarations.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

extern — declarations and linkage

extern lets you declare variables and functions while separating a declaration from a definition. It does not mean that the definition must be in another file. It also appears in language linkage specifications such as extern "C" and in explicit instantiation declarations for templates.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

false — the Boolean false literal

The keyword false is a literal of type bool representing logical falsity. It can initialize flags and control conditions. Promotion to int produces 0, but false itself is not an integer literal.

Basic · C++23; repository compiler flag, production runtime not attested
C++

final — preventing overriding and inheritance

The final specifier prevents further overriding of a virtual function or use of a class as a base class. These restrictions are checked at compile time. It does not make an object immutable and does not replace override.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

for — classic and range-based loops

The for keyword creates either a classic loop with initialization, a condition, and an update, or a range-based loop over elements. Choose the form according to whether you need explicit index control or access to successive elements.

Basic · C++23; repository compiler flag, production runtime not attested
C++

friend — access for a nominated function or class

A friend declaration lets a nominated function or class access private and protected members without making it a member of the granting class.

Basic · C++23; repository compiler flag, production runtime not attested
C++

goto — unconditional jump to a label

The goto statement unconditionally transfers control to a named label in the same function. It can exit multiple nested loops, but remains subject to the rules for initializing and destroying local objects.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

if — conditional statement

The if statement selects a branch using a condition contextually converted to bool. Learn optional else branches, else if chains, initialization before the condition, and the distinction between ordinary if, if constexpr, and if consteval.

Basic · C++23; repository compiler flag, production runtime not attested
C++

import — importing modules and header units

`import` makes a named module's exported interface, a partition of the current module, or a header unit available. It does not textually paste contents like `#include`; importing a named module does not make macros available.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

inline — functions and variables defined in headers

inline allows function and variable definitions in headers while respecting the one-definition rule. It does not force call-site substitution or guarantee a faster program.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

module — module declarations

`module` specifies that a translation unit belongs to a named module or starts a module fragment. Distinguish `export module M;`, `module M;`, and `import M;`: they declare an interface, an implementation, and use of a module, respectively.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

mutable — modifiable members and lambdas

The mutable keyword allows a selected data member to change even in a const object. In a lambda it has a different role: it removes the call operator's default const qualification, allowing modification of modifiable copies of captured values.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

namespace — namespaces

The namespace keyword defines a namespace or a namespace alias. Namespaces group declarations and help distinguish identically named entities; qualified access takes the form N::name.

Basic · C++23; repository compiler flag, production runtime not attested
C++

noexcept — exception specification and operator

noexcept either declares that an exception cannot escape a function or checks at compile time whether an expression is potentially throwing. These two uses combine in the conditional specification noexcept(noexcept(expression)).

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

not — alternative spelling of logical negation

`not` is an alternative spelling of the `!` operator in C++. The built-in operator reverses its operand's truth value and returns `bool`. It is neither bitwise negation nor a separate library function.

Basic · C++23; repository compiler flag, production runtime not attested
C++

not_eq — alternative spelling of the inequality operator

`not_eq` is a language-level alternative spelling of the C++ operator `!=`. It compares two operands using the same rules, precedence, and associativity; it requires neither a header nor a macro.

Basic · C++23; repository compiler flag, production runtime not attested
C++

nullptr — the null pointer literal

nullptr is a null pointer constant with the distinct type std::nullptr_t. Use it to initialize and compare pointers instead of the numeric literal 0, especially when calling overloaded functions.

Basic · C++23; repository compiler flag, production runtime not attested
C++

operator — operator overloading and conversion functions

The operator keyword forms names for overloaded operator functions, conversion functions, and literal operators. It lets you define how operations work on your own types, without changing operator precedence or grouping.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

or — alternative spelling of logical OR

`or` is a language-level alternative spelling of the C++ operator `||`. For the built-in operator, the result is `bool`, and the right operand is evaluated only when the left operand is `false`. Do not confuse it with bitwise OR: `|` or `bitor`.

Basic · C++23; repository compiler flag, production runtime not attested
C++

or_eq — bitwise OR assignment

`or_eq` is an alternative spelling of the C++ `|=` operator. It combines the operands' bits using OR and stores the result in the left operand. It is a reserved language token, not a macro, and requires no header.

Basic · C++23; repository compiler flag, production runtime not attested
C++

override — checking virtual function overriding

override requires a member function to override a virtual function from a base class. It catches declaration mistakes during compilation instead of allowing an inherited function to be hidden accidentally.

Intermediate · C++23; repository compiler flag, production runtime not attested