Constructor

A constructor is a special type of member method that is automatically called when a new object of a class is created. The purpose of the constructor is to initialize the member variables, ensuring that the object is in a valid state upon creation. For example, the constructor for class Person is defined as follows.

def Person(name_, age_) {
    name = name_
    age = age_
}

Since version 3.00.6, constructors support @desc descriptions and argument type annotations. Place @desc immediately before the constructor definition.

Since version 2.00.19, constructors support @desc descriptions and argument type annotations. Place @desc immediately before the constructor definition.