concept constructor in category kotlin

appears as: constructor, constructors, The constructor, constructors
The Joy of Kotlin

This is an excerpt from Manning's book The Joy of Kotlin.

Creating an instance is a recursive process. If the constructor of the class you want to generate instances of only takes parameters for which generators already exist in Gen, just use them. For other types of parameters, use custom generators.

Now, because the block is empty, it can be removed. And you can also remove the word constructor (whether the block is empty or not):

You can also override constructors in a more traditional way:

class Person(val name: String, val registered: Instant = Instant.now()) {
	constructor(name: Name) : this(name.toString()) {
		// optional constructor implementation may be added
	}
}

As in Java, if you don’t declare a constructor, a constructor without arguments is automatically generated.