Cat

Report a typo

In this task, you need to finish writing a simple Cat class.

The first time the name property is used, the line "I prefer to ignore it" should be printed, and the callName() function must be called to set the name property.

The callName() function should print the line "Input the cat name", read the user's answer, and return it.

Write a program in Kotlin
class Cat {
val name: String

fun callName(): String

}
___

Create a free account to access the full topic