Extension Functions & Properties

KOTLIN › Types & Classes

Adding behavior to existing types via statically-resolved extensions, plus Android KTX.

Extensions are everywhere in modern Android and KTX, so interviewers use them to probe whether you understand that they are syntactic sugar over static helper calls, not real inheritance. Expect to be tested on static dispatch versus virtual dispatch, member-versus-extension precedence, nullable receivers, why extension properties have no backing field, and when reaching for an extension actually helps readability versus hiding behavior.

What this covers

Study this topic

Further reading