Vocabulary Word
Scenario:
This code would be much cleaner if we could just add a function to this existing class. It's a hassle to create subclasses for such small features.
Response:
Could we use Kotlin extension functions here? They allow us to add functions to the original class without changing it.
Scenario:
Building utility functions for each of these classes separately is a daunting task. What if we could add these functions directly without modifying the class?
Response:
That's when Kotlin extension functions might be useful. They let us add functions to classes without altering them.