Created
April 26, 2015 20:52
-
-
Save bolilla/2bdd8d3d7408ae6e8efc to your computer and use it in GitHub Desktop.
GoPadawan InterfacesNoInterfaces
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 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