Take a look at the code snippet below:
fun main() {
var cat = Cat("Kitty")
var book = Book("Harry Potter")
printTypeBound(cat)
printTypeBound(book)
}
fun <T : Animal> printTypeBound(item: T) {
println(item.name)
}
open class Animal(var name: String)
class Cat(name: String) : Animal(name)
class Book(name: String)
What will be the result of its compilation and execution? Choose the right answer.