classes


code
Syntax [crayon-5daf00d79ea32287737541/] Functionality If the using-declaration refers to a constructor of a base class (e.g. using Base::Base;), constructors of that base class are inherited. The inherited constructors are equivalent to user-defined constructors with an empty body and with a member initializer list consisting of a single nested-name-specifier, which forwards all […]

Classes: Inheriting constructors


code
Syntax [crayon-5daf00d79fd5a785245192/]   [crayon-5daf00d79fd65447855617/] Functionality It is used to inhibit unintended implicit conversions to bool. Such conversion functions are called explicit conversion operators. In the code below, we have the operator bool, but it’s not marked as explicit. When we want to do + and == calls on objects of […]

Classes: Explicit conversion operators


code
Syntax [crayon-5daf00d7a02fc489915104/]   Usage / Usability Override Can be used only on virtual functions that are declared in a base class. This assures that the function is overriden and not overwritten by mistake. Used to clearly express the intent that a given derived class function is meant to provide a […]

Classes: Override / Final



code
Syntax [crayon-5daf00d7a06ce507765920/] Starting with C++11, a constructor can call another constructor of the same class. Delegating constructors cannot be recursive. Delegate in cases where the delegation makes sense eg. multiple constructors need to call the same function (checks, init etc.). For member initialization, use the in-class member initializer feature instead. […]

Classes: Delegating constructors