Created
May 18, 2017 18:19
-
-
Save eldondevcg/e384c32dbd62bb9cf117b096dc9e1f18 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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