When we create a class or struct, its constructor is called. Constructor will have same name as a class or struct and is usually used to initialize the data members of the new object. There are three types of constructors:
Instance constructors are used to create and initialize any instance member variables when we use new expression to create an object of a class.
Static constructors are used to initialize static data or to perform actions that need to be performed only once. It is called automatically before first instance is created or any of the static members are referenced.
Private constructors are only used when a class contains only static members.