Hey there, is there a way to discover default valu...
# announcements
s
Hey there, is there a way to discover default values for argument from a super class? Consider this example:
Copy code
open class Foo(val name: String = "John", val age: Int = 0)
class DerivedFoo(val title: String = "Guru", name: String, age: Int) : Foo(name, age)
How do I make sure the constructor of DerivedFoo can use the default values from Foo for name and age? Something like this:
Copy code
class DerivedFoo(val title: String = "Guru", name: String = super.name, age: Int = super.age) : Foo(name, age)
Is there a simple way (besides writing 3 variations of the constructor)?