Is it correct to say that the parameters in the default constuctors are not properties unless you don't define them as such? I. E.
class Cippa ( a: Int, val b: String)
b is a property but a is not.
Also, when could it be useful to define parameters that are not properties? Hope the question's clear. Thanks everyone!
p
Pavlo Liapota
12/09/2018, 7:45 AM
For example if property is already defined in super class:
Copy code
open class Base(val name: String)
class Child(name: String) : Base(name)
✔️ 1
Pavlo Liapota
12/09/2018, 7:46 AM
or if you need to do a validation of parameters (but I would create a function in this case I think)
✔️ 1
Pavlo Liapota
12/09/2018, 7:54 AM
And it is called primary constructor 🙂
f
febs
12/09/2018, 7:57 AM
Thanks. Where would you do the validation? In the init block or in a separate function? 🤔