A class is the blueprint for an object. It can contain properties that store data and functions that do the work. In real projects, entities like User, Product, Order, and Course are usually built with classes.
kotlin
class Customer {
var name = ""
fun printName() {
println("Customer name is $name")
}
}
fun main() {
val customer = Customer()
customer.name = "Kyaw"
customer.printName()
}You should see
Customer name is KyawSummary
A class neatly bundles data and behavior together in one place.