Читать книгу Programming Kotlin Applications - Бретт Мак-Лахлин, Brett McLaughlin - Страница 52
LISTING 2.1: The Person code from Chapter 1
Оглавлениеclass Person(var firstName: String, var lastName: String) { var fullName: String // Set the full name when creating an instance init { fullName = "$firstName $lastName" } override fun toString(): String { return fullName } }
Now create another file, also in src/
, and call it PersonApp
. You can then drop your existing main
function into that. That bit of code is reprised in Listing 2.2.