Skip to content

Instantly share code, notes, and snippets.

@eldondevcg
Created May 18, 2017 18:19
Show Gist options
  • Save eldondevcg/e384c32dbd62bb9cf117b096dc9e1f18 to your computer and use it in GitHub Desktop.
Save eldondevcg/e384c32dbd62bb9cf117b096dc9e1f18 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
type Doit struct {
count int64
}
type DoesIt struct {
*Doit
it int64
}
func (a *DoesIt) P() error {
fmt.Printf("%v", a.count)
a.count = a.count + 1
return nil
}
var ate *DoesIt
func Make() *DoesIt {
b := DoesIt{&Doit{}, 10}
ate = &b
b.it = 10
return &b
}
func main() {
a := Make()
a.P()
a.it = 12
a.P()
a.P()
ate.P()
a.P()
fmt.Printf("%v", ate.it)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment