It's a "member initializer list". Member variable int a
is simply initialized with the value 3
. Assigning the value to a
within the constructor would be an assignment.
An initializer list initializes member variables (through the own or a parent class's constructor). If a member variable is not contained in the list, it is default-initialized, i.e. their default constructor is called, which is, for member variables of type int
, an initialization with value 0
.
Conclusion:
Initializing a member variable in the constructor itsself first calls the default constructor and then assigns the particular value to the member.