Constructors are your first opportunity to make sure your custom types are well formed. This episode explains the different kinds of constructors and how you should use them.
The first thing to understand is that constructors are just methods in your class that have some special rules. And you don’t normally call constructors directly.
Your classes can have multiple constructor methods depending on different uses or how easy you want to make it for other code to create instances.
One special constructor is called the default constructor. You’ll use this when you want to be able to construct instances without needing to specify any additional information. This is really just a constructor that takes no parameters. There can only be one default constructor per class.
Another special constructor is called the copy constructor. There can also only be a single copy constructor per class. This is used whenever you want to create a new instance that is a copy of some other variable of the same type. You write this method to take a single parameter of the same type. Usually this will be a constant reference to the other instance.
Other constructors will be whatever you need and will have different parameters.