Created
March 26, 2018 23:33
-
-
Save parzibyte/e0efa45349acccbdc20fe91de3d0b980 to your computer and use it in GitHub Desktop.
This file contains 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
package main | |
import "fmt" | |
type Mascota struct{ | |
edad int | |
nombre, raza string | |
sana bool | |
} | |
func (m *Mascota) ladrar() { | |
fmt.Printf("¡guau! me llamo %s y tengo %d años\n", m.nombre, m.edad) | |
} | |
func main() { | |
mascota := Mascota{ | |
edad: 10, | |
nombre: "Guayaba", | |
raza: "Tampoco la conozco", | |
sana: true, | |
} | |
mascota.ladrar() | |
/* | |
Modificar su edad y luego ladrar de nuevo | |
*/ | |
mascota.edad = 2 | |
mascota.ladrar() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment