Constructors and member initializer lists

Constructors and member initializer lists

Constructor is a special non-static member function of a class that is used to initialize objects of its class type.

In the definition of a constructor of a class, member initializer list specifies the initializers for direct and virtual base subobjects and non-static data members. ( Not to be confused with std::initializer_list ).

Syntax

Constructors are declared using member function declarators of the following form:

class-name ( parameter-list登录查看完整内容