ooftf
ooftf

Reputation: 11

kotlin-variable parameter error when inherit

open class A(vararg vars: String)
class B(vararg vars: String):A(vars)

Error :

Required:String Found: Array

How to solve this problem?

Upvotes: 0

Views: 33

Answers (1)

asm0dey
asm0dey

Reputation: 2931

You need to use spread operator for this

open class A(vararg vars: String)
class B(vararg vars: String):A(*vars)

Upvotes: 1

Related Questions