Skip to content
RED SAG Skills
hard20 pts · first answer countsandroidkotlin

Extension on a subclass

What does this program print?

open class Shape
class Circle : Shape()

fun Shape.name() = "shape"
fun Circle.name() = "circle"

fun main() {
    val s: Shape = Circle()
    println(s.name())
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions