Cursusinhoud
test kotlin
test kotlin
1
Main
class Person(val name: String) { private val friends = mutableListOf<Person>() fun getFriends() : List<Person>{ return friends; } infix fun befriend(person: Person) { friends.add(person) println("${this.name} is now friends with ${person.name}") } } fun main() { val alice = Person("Alice") val bob = Person("Bob") alice befriend bob println(alice.getFriends()) }
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 1