Created
February 22, 2019 12:10
-
-
Save J7mbo/2a0b55a9ae23b0af5e4ef1c14f2d428e to your computer and use it in GitHub Desktop.
golang-constructors-blog-9
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
type MyStruct struct { | |
/* Note how s.child is not a pointer any more */ | |
child ChildStruct | |
} | |
func (s *MyStruct) StructFunc() { | |
if s.child != nil { | |
fmt.Println(s.child.num) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment