Last active
October 24, 2017 14:23
-
-
Save fbcbl/d66efd4b755aa20e62028135c9a3b592 to your computer and use it in GitHub Desktop.
kotlin_testing_pt3_example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User( | |
| private val firstName: String, | |
| private val lastName: String, | |
| private val age: Int) { | |
| val fullName = "$firstName $lastName" | |
| val canDrink = (age >= 18) | |
| val friends: MutableList<User> = mutableListOf() | |
| fun addFriend(user: User) { | |
| if (user !in friends) { | |
| friends.add(user) | |
| user.addFriend(this) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment