Classes can implement shared constructors, as shown in the following code:
Shared constructors are particularly useful for initializing shared members or for loading data that is common to all instances of a class; a shared constructor is invoked immediately before the normal constructor that creates a new instance of the class. With that said the following code is appropriate and accepted by the compiler:
Another important thing to take care of is that shared constructors have Private
visibility and they are the only point in the class in which you can initialize a read-only field.
3.17.167.114