Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 12, 2019 17:14
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 parzibyte/fd21299e6fe7f62fc1de053d3719a869 to your computer and use it in GitHub Desktop.
Save parzibyte/fd21299e6fe7f62fc1de053d3719a869 to your computer and use it in GitHub Desktop.
/**
* Clase en Kotlin
*
* @author parzibyte
* @link https://parzibyte.me/blog
*
* */
class Mascota(var nombre: String, var edad: Int) {
constructor(nombre: String) : this(nombre, 0) {
// Opcionalmente aquí el cuerpo u otras acciones
}
fun dormir() {
println("ZZZZ $nombre duerme")
}
fun saludar() {
println("¡Hola! me llamo $nombre y tengo $edad años. Woof")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment