Last active
August 29, 2015 14:22
-
-
Save bolilla/5124c55347e1cdab89f3 to your computer and use it in GitHub Desktop.
GoPadawan Composición sencilla Err
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 empuñadura string | |
func (e empuñadura) describe() string { | |
return fmt.Sprintf("La empuñadura es de '%s'", e) | |
} | |
type filo string | |
type espada struct { | |
e empuñadura | |
f filo | |
} | |
type vaina string | |
type espadaEnvainada struct { | |
e espada | |
v vaina | |
} | |
func main() { | |
var miEspadaEnvainada = espadaEnvainada{ | |
espada{"Cuero trenzado", "Acero"}, "Cuero curtido", | |
} | |
fmt.Println(miEspadaEnvainada.describe()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment