Nesne Yönelimli Programlama Dillerinde sınıflar önemlidir. Bu gönderide basit bir Sınıf oluşturma örneği bulabilirsiniz.

fun main() {
    var personA = Person("Mike","Sunshine")
    var personB = Person()
    var personC = Person(lastName = "Peterson")

}

class Person (firstName:String ="John" , lastName:String="Doe"){

    init {
        println("A new person object created with First Name: $firstName and " +
                "Last Name: $lastName" )
    }
}
A new person object created with First Name: Mike and Last Name: Sunshine
A new person object created with First Name: John and Last Name: Doe
A new person object created with First Name: John and Last Name: Peterson

Process finished with exit code 0