>If the class has a primary constructor, each s...
# getting-started
s
If the class has a primary constructor, each secondary constructor needs to delegate to the primary constructor, either directly or indirectly through another secondary constructor(s). Delegation to another constructor of the same class is done using the this keyword:
Copy code
class Person(val name: String) {
    constructor(name: String, parent: Person) : this(name) {
        parent.children.add(this)
    }
}
Are there any examples of direct and indirect delegation here? What is
parent.children.add(this)
?
s
parent
is a parameter