Challenge 2: An expect class — Solution // ── commonMain/kotlin/Logger.kt ── expect class Logger() { fun log(message: String) } fun logTestMessage(logger: Logger) { logger.log("This is a test message") } // ── androidMain/kotlin/Logger.kt ── actual class Logger { actual fun log(message: String) { println("[Android] $message") } } // ── iosMain/kotlin/Logger.kt ── actual class Logger { actual fun log(message: String) { println("[iOS] $message") } } fun main() { // Standing in for whichever platform's actual Logger would really be // compiled in — here just constructing one directly to demonstrate. val logger = Logger() logTestMessage(logger) } /* Output (using the androidMain actual, for example): [Android] This is a test message Notes: - "expect class Logger()" declares both the class and its constructor shape in commonMain, with the actual behavior of log() left to each platform. - Each actual class Logger provides a genuinely different implementation — different log prefix — while presenting the exact same public shape (a no-arg constructor, a log(String) function) that commonMain code depends on. - logTestMessage() is written once in commonMain and works correctly no matter which platform's actual Logger ends up compiled in — it never branches on platform itself. */