https://kotlinlang.org logo
#getting-started
Title
# getting-started
k

keishi kubo

07/24/2021, 12:23 PM
I want to access parent class constructor from extended class. Like this.. How can I do this ?
Copy code
class A {
  generateInstance(): this:class {
     return this::class()
  }
}
class B: A() 
val b: B = B().generateInstance()
e

ephemient

07/24/2021, 12:29 PM
k

keishi kubo

07/24/2021, 12:33 PM
Thank you. I am surprised to know that there is something kotlin cannot do. Kotlin seemed too perfect.
a

Ayfri

07/24/2021, 2:57 PM
What is "trait" ?
t

Tobias Berger

07/24/2021, 7:27 PM
in very early versions of kotlin they used the keyword
trait
instead of
interface
a

Ayfri

07/24/2021, 8:14 PM
Oh I see thanks !
3 Views