Sobes.tech
Back to tasks
Junior — Middle+
54

Проверка и корректировка кода классов-родителя и наследника

Companies where asked:

IBS
Get help with live coding in real time with Sobes Copilot
Task condition

Требуется выявить и устранить ошибки в следующем фрагменте кода.

class ParentClass {
    private val age = 10
    protected val name = "Bob"

    protected class Nested {
        public val friendName: String = "Alice"
    }
}

class ChildClass : ParentClass() {
    override val age = 25

    fun tryIt() {
        println("$name is $age")
        println("${Nested.friendName} friend for $name")
    }
}