Skip to content

Instantly share code, notes, and snippets.

@bolilla
Created April 26, 2015 20:52
Show Gist options
  • Save bolilla/2bdd8d3d7408ae6e8efc to your computer and use it in GitHub Desktop.
Save bolilla/2bdd8d3d7408ae6e8efc to your computer and use it in GitHub Desktop.
GoPadawan InterfacesNoInterfaces
package main
import "fmt"
type perro string
func (p perro) hablar() {
fmt.Println("Guau, guau! Soy un perro llamado", p)
}
type gato string
func (g gato) hablar() {
fmt.Println("Miau, miau! Soy un gato llamado:", g)
}
func main() {
var miPerro perro = "Lassie"
miPerro.hablar()
var miGato gato = "Mizifú"
miGato.hablar()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment