We break down an interface in Kotlin as a contract: what exactly a class “promises” when it writes
:
SomeInterface, how
fun methods work without a body and with a default implementation, why
val/
var properties in an interface are not “storage fields”, and how to write reusable functions that accept an interface type (for example,
CliPrintable) instead of concrete classes. Inside: practical examples with
Identifiable,
Greeter,
RenderableLine, and
HasTitle, plus a walkthrough of typical mistakes.