Override the candidate

Report a typo

There is a snippet of code:

open class Transport(val cost: Int) {
    open fun getFullInfo(): String = "$$cost cost"

    fun getTax(): String = "$${(cost * 0.25).roundToInt()} tax"
}

open class WaterTransport(cost: Int, val color: String) : Transport(cost) {
    open fun getColorInfo(): String = "$color color"
    
    fun getWaterTax(): String = "$${(cost * 0.3).roundToInt()} tax"

    override fun getFullInfo(): String = "$$cost cost, $color color"
}

Let's create the Boat class as a child of the WaterTransport class. Which functions can be overridden in the Boat class?

Select one or more options from the list
___

Create a free account to access the full topic