Skip to content

Instantly share code, notes, and snippets.

@javouhey
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save javouhey/9225372 to your computer and use it in GitHub Desktop.

Select an option

Save javouhey/9225372 to your computer and use it in GitHub Desktop.
#golang object creation
type Stack struct {
a int
b string
}
func main() {
t := Stack{}
s := Stack{b: "a"}
t := Stack{1, "a"}
t := Stack{a: 42}
}
// http://areyoufuckingcoding.me/2012/07/25/object-desoriented-language/
type Person struct { Name string }
type Woman struct { Person }
func main() {
w := Woman{Person: Person{Name: "laetitia"}}
fmt.Println("hello", w, w.Name)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment