Skip to content

Instantly share code, notes, and snippets.

@cassiozen
Created November 29, 2018 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cassiozen/b28b8785dc9e78330a36caa1b9edf632 to your computer and use it in GitHub Desktop.
Save cassiozen/b28b8785dc9e78330a36caa1b9edf632 to your computer and use it in GitHub Desktop.
class Monster(val name: String, val color: String, val numEyes: Int) {
fun speak(likes: String):String {
return "My name is $name and I like $likes"
}
}
var nhama = Monster("Nhama", "red", 1)
// Kotlin doesn't have a `new` keyword - you instantiate a class by calling it directly
nhama.speak("guacamole")
// "My name is Nhama and I like guacamole"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment