Constructors

A member function with the same name as its class is a constructor function. Constructors cannot return values, even if they have return statements. Specifying a constructor with a return type is an error, as is taking the address of a constructor.

If a class has a constructor, each object of that type is initialized with the constructor prior to use in a program. (For more information about initialization, see Initialization Using Special Member Functions.)

Constructors are called at the point an object is created. Objects are created as: