What are extension functions?

Updated May 16, 2026

Short answer

Add functions to existing classes without modifying them.

Deep explanation

They provide syntactic sugar for utility methods.

Real-world example

Adding helpers to String or List.

Common mistakes

  • Confusing with inheritance.

Follow-up questions

  • Can they access private members?
  • Are they static?

More Kotlin interview questions

View all →