Initializing Bases and Members

An object of a derived class is made up of a component that represents each base class and a component that is unique to the particular class. Objects of classes that have member objects may also contain instances of other classes. This section describes how these component objects are initialized when an object of the class type is created.

To perform the initialization, the constructor-initializer, or ctor-initializer, syntax is used.

Syntax

ctor-initializer :

mem-initializer-list

mem-initializer-list :

mem-initializer
mem-initializer , mem-initializer-list

mem-initializer :

complete-class-name ( expression-listopt )
identifier ( expression-listopt )

This syntax, used in constructors, is described more fully in the next section, Initializing Member Objects, and in Initializing Base Classes.