Rewiew code

Report a typo

A student wrote code that does not compile, and we were asked to do a code review. Find the error in the code and fix it so that the code works correctly. In this code, the student tried to create a base class with a private property and function, as well as a successor class that calls the private function of the base class.

Write a program in Kotlin
open class BrokenPrivateBase {
private val brokenPrivateTaskProperty: String = "Private property"
private fun brokenPrivateTaskFunction() {
println("Private function")
}
}

class BrokenPrivateDerived : BrokenPrivateBase() {
fun showBrokenPrivateElements() {
println(brokenPrivateTaskProperty)
brokenPrivateTaskFunction()
}
}
___

Create a free account to access the full topic