What does the program print?

Report a typo

Look at this code:

open class ProtectedTaskParent {
    protected val protectedTaskProperty: String = "Protected property"
    protected fun protectedTaskFunction() {
        println("Protected function")
    }
}

class ProtectedTaskChild : ProtectedTaskParent() {
    fun showProtectedElements() {
        println(protectedTaskProperty)
        protectedTaskFunction()
    }
}

fun main() {
    val protectedTaskChild = ProtectedTaskChild()
    protectedTaskChild.showProtectedElements()
}

We created a base class with a protected property and function. Then, we created a successor class and called these protected elements.
What is the output to the console as a result of the program execution?

Enter a short text
___

Create a free account to access the full topic