MΓ³dulo 02 Β· Kotlin, One Level Deeper β LecciΓ³n 2 de 5 Β· ~12 min
Data Classes: Your Own Types
Making your own types
Int, String, Double β those are Kotlin's built-ins. But PawWalk thinks in walkers, pets, and bookings. A data class lets you define a type of your own: a named bundle of values, with useful behavior generated for free.
Each val name: String inside the parentheses is a property β a piece of data that every value of the type carries. You read one with a dot: walker.name.
You've already met the most important data class in the app. Here it is for real: