Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlinclass delegation bySingle-choice MCQ

If a class both delegates an interface with 'by' and overrides one of its methods, which implementation runs for that method?

interface Counter { fun next(): Int } class Base : Counter { var c = 0 override fun next() = ++c } class Capped(b: Counter) : Counter by b { override fun next() = 99 }