To customize how class members are initialized, or to invoke functions when an object of your class is created, define a constructor. A constructor has the same name as the class and no return value. You can define as many overloaded constructors as needed to customize initialization in various ways. Typically, constructors have public accessibility so that code outside the class definition or inheritance hierarchy can create objects of the class. But you can also declare a constructor as protected or private.
Constructors can optionally take a member init list. This is a more efficient way to initialize class members than assigning values in the constructor body.