You have a generic class Box that stores a value of some type. Define an extension function guessBox() that prints the following line : "In this box you have: ITEM", where ITEM is the content of the box.
Generic functions
Guess what's in the box
Report a typo
Write a program in Kotlin
class Box<T>(val item: T)
// define the function
fun <T> Box<T>.guessBox() {
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.